I have developed a calculator for permutations and combinations. When either permutation or combination is selected, and the required values are entered, I want the calculate button to light up. How can I achieve this without using setInterval in my current code:
function checkCalc(){
if(((permutation==true)||(combination==true))&&(document.getElementById('r').value.length>0)&&(document.getElementById('n').value.length>0)){
calculate.style.backgroundColor="#ccccff";
calculate.style.boxShadow="10px 10px 5px gray";
}
else{
calculate.style.backgroundColor="gray";
}
}
setInterval(checkCalc, 50);
If I remove the function (just leaving the if statement), the functionality doesn't work as intended.