T&C mandatory checkbox not working

mrfarmersg
Tourist
10 0 4

Hi!

I've included a T&C checkbox on my "create an account" page and I want to make it mandatory for the customers to accept the terms before they are allowed to create an account.

I used this code under theme.js 

 

  $(document).ready(function() {
    $('body').on('click', '#RegisterForm .btn', function() {
      if ($('#agree').is(':checked')) {
        $(this).submit();
      }
      else {
        alert("You must agree with the terms and conditions of sales to check out.");
        return false;
      }
    });
  });

 

But I can still create an account without checking the T&C box. How do I troubleshoot this?

This is the code I have under customers/register.liquid

 

     <p style="float: none; text-align: left; clear: both; margin: 10px 0;">
  <input style="float:none; vertical-align: middle; margin:0; margin-right: 6px;" type="checkbox" id="agree" />
  <label style="display:inline; float:none" for="agree">
    I agree with the <a href="/pages/terms-and-conditions">terms and conditions</a>.
  </label>
</p>

 

 

0 Likes