tags:

views:

39

answers:

2

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.

+3  A: 

This should do it:

$(':not(.noFocusOnKeypress)').live
Kobi
+2  A: 

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()
Jimmy Cuadra