开发者

How to ignore click() if an element has a certain class in jQuery?

开发者 https://www.devze.com 2023-03-02 18:14 出处:网络
I know this should be easy stuff, but for some reason the click event is still firing fo开发者_如何学JAVAr the element that has a \"selected\" class.

I know this should be easy stuff, but for some reason the click event is still firing fo开发者_如何学JAVAr the element that has a "selected" class.

Can anyone spot the problem with this line?

h.find("li a").not("li a.selected").click(function () {


Use

.not('.selected')

The not() filter applies to the current element


$(function() {
    $('div:not[.someclass]').click(function() {
        // do stuff
    });
});
0

精彩评论

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