I want to open images with some kind of lightbox, colorbox for an example. How would it be possible to open only link which have images inside them and are in .content class?
Something like:
$('.content a img').colorbox();
I want to open images with some kind of lightbox, colorbox for an example. How would it be possible to open only link which have images inside them and are in .content class?
Something like:
$('.content a img').colorbox();
You can use the :has()
selector:
$('.content a:has(img)').colorbox();
In case you already have a jQuery object $('.content a')
containing all links you could also call .has('img')
on it to reduce its elements just like the selector would do.