Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<html>
<head>
<script language="javascript">
function validateData(){
if (document.getElementById("txt").value != "correct"){
alert('That is not correct, please try again');
return false; // if false is returned, the form action will not take place and the form won't submit
} else {
alert('That is correct, form will submit');
return true; // if true is returned, the form action will take place and the form has been submitted
}
}
</script>
</head>
<body>
<form id="theForm" method="post" onSubmit="return validateData()" action="javascript:alert('It has submitted')">
<!-- Note the return in the onSubmit above, that is VERY important -->
<input id="txt" type="text"><br>
<input type="submit">
</form>
</body>
</html>