jQuery: $('li[class=]')(selects both elements that do not have a class attribute, as well as those for which the attribute is present but empty)
The CSS selector li[class=""], unfortunately, does not work the same. It selects only those elements for which the attribute is present but empty (ex: <li class></li>or <li class=""></li>)
The solution $('li:not([class])')may not be what you want (it does not display elements that have a class attribute but are empty).
Given:
<ul>
<li>item 1</li>
<li class>item 2</li>
<li class="">item 3</li>
<li class="some-class">item 4</li>
</ul>
$('li[class=]')selects 1,2,3
$('li[class=""]')selects 2,3
$('li:not([class])')selects only 1
source
share