53
rated 0 times
[
54]
[
1]
/ answers: 1 / hits: 31370
/ 13 Years ago, sat, november 12, 2011, 12:00:00
So I'm just testing something with js, basically the number in the first input has to be bigger than the number in the second input for the submit button to be activated.
The button get's disabled just right, but if I change the number it won't activate again
<!DOCTYPE HTML>
<html>
<body>
<input type='number' id='first' onchange=validateNumber()/><br>
<input type='number' id='second' onchange=validateNumber()/><br>
<script type=text/javascript >
function validateNumber()
{
var first = document.getElementById('first').value;
var second = document.getElementById('second').value;
if(first > second){
document.getElementById('sub').disabled=false;
}else{
document.getElementById('sub').disabled=true;
}
}
</script>
<input type=submit id=sub/>
</body>
</html>
Edit:
The arrows of the number input trigger onchange it seems, that caused the problem
More From » html