Alert to tick a check box if the form is submitted without ticking it.Please find the error in this. Thanks in advance. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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>

24th May 2020, 9:12 AM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar
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>
24th May 2020, 10:04 AM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
24th May 2020, 1:13 PM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar