I have a javascript which checks every 5 seconds if a parent div has 1 child div or more than 1 child div
HTML :
<div id="program-days">
<div class="row">program 1</div>
<div class="row">program 2</div>
<div class="row">program 3</div>
</div>
How I can disable the function below, if #program-days
has only 1 child div :
$(document).ready(
function () {
checkProgramData();
checkProgram = setInterval(checkProgramData, checkProgramInterval);
});
Can I use a script something like this? :
setInterval(function(){
if(jQuery('div#program-days .row').length > 1){
// enable function
}
else{
// disable function
}
}, 1000);