开发者

jquery file type selector

开发者 https://www.devze.com 2022-12-22 20:02 出处:网络
What is the correct jQuery synt开发者_开发百科ax to only select certain file types? e.g. $(\"#fragment-1 a[SELECT ONLY ANCHOR TAGS WITH FILE TYPE OF MP3]\").hide();

What is the correct jQuery synt开发者_开发百科ax to only select certain file types?

e.g.

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

Thanks.


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.


This should work

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消