开发者

not class selector doesn't seem to work with anchor

开发者 https://www.devze.com 2023-03-19 15:49 出处:网络
I have a wrapped set like this: var $anchors = $(\'a\'); I then do some JQuery code to confirm a deletion and etc... everything was working great until I started adding other anchors to my site tha

I have a wrapped set like this:

var $anchors = $('a');

I then do some JQuery code to confirm a deletion and etc... everything was working great until I started adding other anchors to my site that hav开发者_C百科e classes that do different things

I'm trying to use the :not in JQuery to eleminate certain classes from this generic anchor wrapped set, so that the configme delition and etc doesn't occur, but can't seem to get it to work... what am I missing? Here is the updated selector I am trying to use:

var $anchors = $('a:not(".excludedanchorclass")');


No quotes:

var $anchors = $('a:not(.excludedanchorclass)');


You can also use jquery filter

var $anchors = $('a').filter(':not(.excludedanchorclass)');
0

精彩评论

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