How can I get DIV elements not having a class ("test-class") inside a main DIV#Main?
I am trying var count = 0; $("#Main > div").each(function(){ if(!($(this).hasClass(".test-class"))) { count += 1; } }); alert(count); But this is not the correct way I think. How can I do it?