when user clicks the button I want to check if user entered an integer value in the box above. If false show alert message, if true go to next page. What am I missing, it seems so simple...
<html>
<body>
<script type="text/javascript">
function checkInteger() {
var userData = document.getElementById("userInput");
if((typeof(userData)=='number') && (myNum.toString().indexOf('.')==-1)) {
return true;
}
else {
alert("Error!");
return false;
}
}
</script>
<form action="page2.html" enctype="multipart/form-data" onsubmit="return checkInteger()">
<input type="text" id="userInput"> Enter number here </input>
<br><br><br>
<input type="submit" value = "Test" />
</form>
<br>
</body>
</html>
Thanks! :)