HTML.form.guide

Checkbox validation using jQuery

Suppose you have a check box with ID agree_checkbox. You can check whether the checkbox is checked using this jQuery code:
$('#agree_checkbox').prop('checked')

Here is a complete example:

Here is the code that does the check:

$("#myform").on("submit",function(form) {  if(!$("#agree_checkbox").prop("checked"))  {  $("#agree_chk_error").show();  }  else  {  $("#agree_chk_error").hide();  }  return false; }) 

See Also