I want to get the url of the product clicked and then load only a certain div of the product page in a sidebar
I the below code works id I remove the + '#product-description'
$(function(){
jQuery(document).on("click",".test-click",function(e){
e.preventDefault();
var el = jQuery(this);
alert(el.attr("href"));
$('#content').load(el.attr("href") + '#product-description');
});
});
According to jQuery .load documentation here, you need one or more spaces between the URL and the tag, so try
$('#content').load(el.attr("href") + ' #product-description');