0
How to make the button disabled based on these two conditions
Hello, how do I make the calculate button disabled when either only 1 input has a value or MORE THAN 2 inputs have values? Also it should be disabled when atleast one input is 0? I have the css styles when the button should be disabled. Thanks in advance https://code.sololearn.com/WQ383vPhQOMw/#js
3 odpowiedzi
+ 2
Just use keyup event on input box. Call a function on that event and make button disabled.
+ 1
https://www.w3schools.com/jsref/prop_pushbutton_disabled.asp
JS
document.getElementById("myBtn").disabled = true;
JQuery
$(selector).prop('disabled', true);
or
$(selector).attr('disabled', true);
+ 1
Thanks