5
I have a form that sends the values entered in input
to another page. I want to do a validation between inputs, if a number is larger than another, and if it is not, do not go to the second page and warn with a alert
.
This is my HTML code:
<form action="_graphes.php" method="post">
<input type="time" id="time_debut" name="time_debut" step="1" value=''>
<input type="time" id="time_fin" name="time_fin" step="1" value='' >
<input id=btn type=submit name=go value=ok>
</form>
And the javascript:
if(document.getElementById("time_debut").value > document.getElementById("time_fin").value){
alert("Maior");
}
The button type has to be button, or with Submit it always goes to the next page.
– akm
@akm switched to 'button', thanks.
– William Pereira