If I have the following markup how can I check if each div inside each child does not have class hidden and if it has a data-access attribute that its value is equal to the value of the class in div with id=main
<div id="main" class="agent">
<div class="child">
<div class="area hidden" >
<div class="section">
<div data-type="text" >
<input type="text" name="firstname">
</div>
</div>
</div>
</div>
<div class="child">
<div class="area" data-access="agent">
<div class="section">
<div data-type="text" >
<input type="text" name="lastname">
</div>
</div>
</div>
</div>
<div class="child">
<div class="area">
<div class="section">
<div data-type="text" >
<input type="text" name="refnumber">
</div>
</div>
</div>
</div>
I can do the following but that only check if the divs don't contain the hidden class.
$('.child').each(function(index, element) {
$(element).find('.area:not(.hidden) .section:not(.hidden) div[data-type]:not(.hidden)').each(function(index, ele) {
}
}
Along with checking if the divs do not contain a hidden class I want to check if each of those divs also contains a data-access attribute and if it does then check if the value is equal to the value of the class in <div id="main" class="agent">