i have a form i have a doubt on, it's on a user input where i need to apply this logic:
<input type="number" name="num" placeholder="kmfim">
<div id="error"></div>
<script>
var numb=document.forms['myform']['num'];
var error=document.getElementById('error');
function validation()
{
if(numb.value == '')
{
alert("cannot be empty");
error.innerHTML="Number field cannot be empty";
error.style.display="block";
return false;
}
if(numb.value < idkm)
{
alert("cant insert less then last time");
error.innerHTML="cant insert less then last time";
error.style.display="block";
}
return true;
}
</script>
idkm its a place to store current idkm, and in the form the input kmfim will grab the kmfim and in my insert page i update the idkm with the kmfim inserted on this form thanks in advance