Answer the question
In order to leave comments, you need to log in
How to add a class to a link containing an image?
I'm using Fancybox and adding the large class and rel="group" for the image links after the page has loaded.
$(".text a").addClass("large").attr('rel', 'group');
Answer the question
In order to leave comments, you need to log in
You can, the 3rd node (orbiter) is needed if you need to switch to the second node when the master falls.
> (in fact, it will be in the wings)
without the 3rd node, you will quickly / simply not switch to the slave
For example, with filter :
$('a').filter(function( index ) {
return $("img", this).length === 1;
})
1. Why do this in Javascript? This is not rational.
2. If you still need it for some reason, then regular expressions and the test function will help you:
a) get the href value of the link b) execute the test
function
c) the regular expression must contain a check for .jpg, .jpeg, .png, .gif
To learn how to write regular expressions, read this article first
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question