views:

123

answers:

2

Hi,

What is the correct jQuery syntax to only select certain file types?

e.g.

$("#fragment-1 a[SELECT ONLY ANCHOR TAGS WITH FILE TYPE OF MP3]").hide();

Thanks.

+1  A: 

Try this attribute substring selector:

#fragment-1 a[href$=".mp3"]

The a[href$=".mp3"] will select only those a elements whose href attribute value ends with .mp3.

Gumbo
+1  A: 

This should work

$("#fragment-1 a[href$=.mp3]").hide();

Reference: http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors

Chad

related questions