The title might have been confusing, anyways, basically let's say this is how my HTML looks like:
<span></span>
<span></span>
<div class='box'>
<span></span>
<span></span>
<span class='doNotCountThisOne'>
</div>
<span></span>
<span></span>
So this would return 2. Basically I want to check for all <span>
s within a specific class (box in this case) that does not contain their own classes. (I.E like the doNotCountThisOne span)
I tried something like:
var cAmounts = 0;
var test = $(".box span:not([class]), span[class='']");
test.each(function() {
cAmounts++;
console.log(cAmounts);
}
But it seems to add all <span>
s without a class on the whole page.
Thanks in advance.