开发者

Using Jquery, how to Grab all links with class 'c1' and has abcdef in the href

开发者 https://www.devze.com 2023-01-26 03:44 出处:网络
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.

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

0

精彩评论

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