0

I am not sure why this isn't working. I am confused and I don't know how to solve it. Please anyone guide me so that I can find out the solution.

Thanks.

    terms=$('#terms').val();
        if (terms == '') {
            ...
        }
    <input id="terms" class="inputcheckbox" name="terms" type="checkbox">
V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
Chien Darus
  • 73
  • 1
  • 1
  • 5
  • 1
    Add a console.log(terms) and see what it returns... (before the if-condition) – junkfoodjunkie Nov 15 '16 at 18:59
  • You can check this link:-http://stackoverflow.com/questions/1535187/how-to-validate-a-form-with-multiple-checkboxes-to-have-atleast-one-checked or link:-http://stackoverflow.com/questions/426258/setting-checked-for-a-checkbox-with-jquery – Razia sultana Nov 15 '16 at 19:03

1 Answers1

0

function validate() {
  terms=$('#terms').prop('checked');
  console.log(terms);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="terms" class="inputcheckbox" name="terms" type="checkbox">
<button onclick="validate()">Validate</button>
Dan Wilson
  • 3,937
  • 2
  • 17
  • 27