Using Jquery, how to Grab all links with class 'c1' and has abcdef in the href
Using jquery, I want to get all links on the page with the css class 'c1' and that have 'abcdef' in the url of the href.
So far I know how 开发者_运维技巧to do:
$(".c1")
You can use an attribute-contains selector ([attr*=val]
), like this:
$("a.c1[href*=abcdef]")
Try something like
$('a.c1[href*="abcdef"]')
For more on jQuery selectors see Selectors
精彩评论