1

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 each tr.

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

3 Answers 3

4
if($('#itable tr:not(.mod)')[0]){
    //something
}
Sign up to request clarification or add additional context in comments.

Comments

1
#itable tr:not(.mod)

Comments

1

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.