Reputation: 177
I want to add Lightbox to a image which is output by Javascript. The image link is built up dynamically so thats why I am doing it this way!
I have looked on S.O. but no luck with what is already there...
The code currently is;
$("#imgMain img").attr("src","/_images/multi/"+productCode+"/"+imgCodeAlt+"_l.jpg");
And i somehow need to append it with rel="lightbox"
Thanks in advance :)
Shaun
Upvotes: 1
Views: 267
Reputation: 12190
Try using -
$("#imgMain img").attr({
src: '/_images/multi/"+productCode+"/"+imgCodeAlt+"_l.jpg',
rel: 'lightbox'
});
Upvotes: 1