I am trying to check if all divs are visible, and if they are then to not show a div which contains a submit button. All the divs are basically validators that only show if there are errors. This is because I cannot use Jquery validator. I am doing this on a timer so it can check every 5 seconds, instead of using a button. Also - It is not possible to link the validation to the button.
What I've tried:
JS:
window.setInterval(function(){
if ($(".needData:hidden").length == 0) {
$(".answer").show();
$(".pleaseval").hide();
}else{
$(".answer").hide();
$(".pleaseval").show();
}
}, 5000);
HTML:
div id="myClass" class="needData" style="display:none">hidden</div>
div id="myClass1" class="needData" style="display:none">hidden</div>
div id="myClass2" class="needData" style="display:none">hidden</div>
div id="myClass3" class="needData" style="display:none">hidden</div>
<div class="pleaseval">Please fill out form</div>
<div id="answer" class="answer"><button>button</button></div>