For example I have to do it manually like this:
function checkDivUppersClosed() {
var allOpened = true;
$('.classUpper').each(function (index, domEle) {
allOpened &= $(this).parent().hasClass('closed');
});
return allOpened;
}
I know that if I select $('.closed').size() will return the length as well. But in my case, some divs have the class classUpper but not at all.
To do the literal version of your current check you can do this:
This would return the count that aren’t closed (parents of these elements that do
:not()have theclosedclass). You could use the number as a true/false check still, or add a=== 0to be explicit.Though if the
closedclass is being added to hide them, you can use the:visibleselector, like this: