get all divs which has class attribute
$('div[class]')
get all divs which do not have class attribute
$('div[class!=""]')
This code works but I don't understand why it works. If the above code works then the code for all divs with class attribute should be
$('div[class=""]')
which does not yield any result.