Try it with the :not()
pseudo-class selector:
$('div:not([class])')
Edit
The description for the jQuery selectors say:
[attribute]
Matches elements that have the specified attribute.[attribute=value]
Matches elements that have the specified attribute with a certain value.[attribute!=value]
Matches elements that either don’t have the specified attribute or do have the specified attribute but not with a certain value.
This means div[class=""]
would select all DIV elements that have a class
attribute specified with an empty value.
But the last selector is a proprietary selector of jQuery and not a CSS selector. You would need to use :not()
to select all DIV elements that do not have a class:
div:not([class])