Reputation: 79686
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.
Upvotes: 2
Views: 6022
Reputation: 37081
Just remove body
from 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:
$(':not(.noFocusOnKeypress)').live()
Note that this might be a fairly inefficient selector (I'm not familiar with the internals of the :not
pseudo-class) and that it might improve performance to scope it a bit, like so:
$('#div-that-contains-these-elements :not(.noFocusOnKeypress)').live()
Upvotes: 3