i want to select all elements without a special class.
i used:
$('body:not(.noFocusOnKeypress)').live('keyup' ...
but it didnt work. and i have no idea why.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just remove
bodyfrom your selector. As it stands, you are selecting all body elements that don’t have that class, not all elements of any type that don’t have that class. What you want is this:Note that this might be a fairly inefficient selector (I’m not familiar with the internals of the
:notpseudo-class) and that it might improve performance to scope it a bit, like so: