I have the following markup:
<div id="app">
<div class="1hidden1></div>
<div class="123"></div>
<div class="hidden"></div>
</div>
How can I check if a div in the DOM has a class name that contains the text hidden
? The desired output would be true
for the above code.
Here is what I have so far, but this only checks for the third div in the example above:
if (document.getElementById('app').classList.contains('hidden')) {
// this does not select the first div within #app
}
I would like to check for both the third and first div -- any div that contains a class name with the text hidden
.