Colorbox wont accept dynamic url it appears?, not sure why this wont work.. (selector is image with ‘scr’ that has dynamic generated value (sku). Any ideas?
on doc ready.;
$('.product-selected .column-2 img').css('cursor', 'pointer').colorbox({
href : '/loading-designer?sku='+$(this).attr('alt')+'&type=direct'
});
You need to control for the value of ‘this’ (the execution context). In this situation,
$(this).attr('alt')is probablyundefinedbecausethisprobably refers to the window object.To make sure that
thisrefers to your img element, you could do something like this:Or this: