JS Check agreement checkbox on form submit


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. function check_agreement() {
  3. //if the agreement checkbox is checked, return true, otherwise return false
  4. if(document.getElementById('LocationAgree').checked == true) {
  5. return true;
  6. } else {
  7. alert('Please agree to the terms and conditions.');
  8. return false;
  9. }
  10. }
  11. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.