jQuery find selector problem
-
13-09-2019 - |
Question
I got such code:
$('.mainp').find('A[href$=jpg]','A[href$=jpeg]','A[href$=gif]','A[href$=png]').fancybox();
And it works only for .jpg files. When I change it to:
$('.mainp').find('A[href$=png]').fancybox();
It works for .png files. So what I'm doing wrong, that fancybox() is not working with all type of files?
Solution
The commas belong in the string, I don't think find
can take many parameters.
$('.mainp').find('A[href$=jpg], A[href$=png]').fancybox();
See also: Selectors/Multiple
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow