开发者

jQuery CSS selector question

开发者 https://www.devze.com 2022-12-17 18:29 出处:网络
Whats wrong with this CSS selector i\'m using in jQuery? Trying to select all tr\'s within a table of ID \"itable\" without a class of \"mod\" where its possible for multiple classes to be on eac开发者

Whats wrong with this CSS selector i'm using in jQuery? Trying to select all tr's within a table of ID "itable" without a class of "mod" where its possible for multiple classes to be on eac开发者_如何学Goh tr.

if($('#itable tr:not[class~=mod]').length == 0){
    //something
}


if($('#itable tr:not(.mod)')[0]){
    //something
}


#itable tr:not(.mod)


youre using the :not selector the wrong way http://docs.jquery.com/Selectors/not#selector

if($('#itable > tr:not(.mod)').length == 0){
    //something
}
0

精彩评论

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