views:

119

answers:

1

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?

+5  A: 

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

Kobi