I’m making a DIV clickable like so:
jQuery(".post").click(function(){
window.location=jQuery(this).find(".post-title a").attr("href");
return false;
});
but I also want to add rel attribute to it so the link can open in a lightbox. I tried adding .attr("rel=prettyphoto") but it doesn’t seem to work.
You should add the
relattribute on page load, not on click, and make sure you do that before you init the lightbox script. There is not point in setting the attribute on click, as the page reload would take place anyway, and the attribute would be gone.So: