views:

72

answers:

1

I want to select all elements in my page except those with the class "searchBox".

How can I do that?

I want to disable text selection on all elements except input elements

+5  A: 
$('* :not(.searchBox)'); 

* : Matches all elements.

not: Filters out all elements matching the given selector

Svetlozar Angelov
Are you sure about the space between * and :not ? Space is the descendant operator in CSS selectors.
subtenante
`$(':not(.searchBox)');` will work almost the same. @subtenante - usually, you are correct, and adding the space is a common mistake. Here it doesn't matter though, because all element are under something anyway (all elements are under `<body>` or deeper, so this version may miss the body tag).
Kobi