Jquery type selector

What is the proper jQuery syntax for selecting specific file types?

eg.

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

Thank.

+3
source share
2 answers

Try the attribute substitution selector :

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

a[href$=".mp3"]will select only those elements awhose attribute value hrefends with .mp3.

+6
source

This should work

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

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

+1
source

Source: https://habr.com/ru/post/1737032/


All Articles