+ 1
Alert to tick a check box if the form is submitted without ticking it.Please find the error in this. Thanks in advance.
Here's my code <html> <head> <script> function checkbox() { if(check.checked == false) { alert("Please accept our terms and conditions!") return false; } return true; } </script> </head> <body> <div class="sign-up-form"> <form name="signup" onSubmit="return validateform()" action="WelcomeTechnoWorld.html" method="post"> <p><span><input name="check" type="checkbox"></span> I agree to the terms of services</p> <p> <input type="submit" class="signup-btn"> </p> </form> </div> </body> </html>
2 Answers
+ 1
<html>
<head>
<script>
function checkbox() {
if(document.signup.check.checked === false) {
alert("Please accept our terms and conditions!")
return false;
}
return true;
}
</script>
</head>
<body>
<div class="sign-up-form">
<form name="signup" onsubmit="return checkbox()" action="WelcomeTechnoWorld.html" method="post">
<p><span><input name="check" type="checkbox"></span> I agree to the terms of services</p>
<p> <input type="submit" class="signup-btn"> </p>
</form>
</div>
</body>
</html>
+ 1
Thank you so much Basel Al_hajeri ?.`ďźďź˘ďź¨`