开发者

help with multiple :not class's

开发者 https://www.devze.com 2023-02-09 03:35 出处:网络
I have the following jQuery selector but it is not working. I am unsure of the correct syntax. What I want to do开发者_如何学编程 is select a link with href equal to variable star_link but only if it

I have the following jQuery selector but it is not working. I am unsure of the correct syntax. What I want to do开发者_如何学编程 is select a link with href equal to variable star_link but only if it does not have any of the four classes shown below. Thanks for any help.

$('a[href=' + star_link + ']:not(.smalltext.colors_text.productnamecolor.colors_productname)') 


Try this :

$('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname)');

Note also the double quotes after the href, wich you should always use in that context.


use comma b/w selectors-

$('a[href=' + star_link + ']:not(.smalltext, .colors_text, .productnamecolor, .colors_productname)')

reference multiple-selector

0

精彩评论

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