how to check if a check box is checked code example

Example 1: if checkbox is checked

if ($('#id_input').is(':checked')) { }

Example 2: jquery on checkbox checked es6

$("input[type='checkbox']").on('change', (e) => {
      console.log("Checked Value 'is' :: ", e.currentTarget.checked);
 })

Example 3: check if checkbox is checked javascript

<script type=text/javascript>
  function validate(){
    if (remember.checked == 1){
      alert("checked") ;
    } else {
      alert("You didn't check it! Let me check it for you.")
    }
  }
</script>

<input id="remember" name="remember" type="checkbox" onclick="validate()" />

Tags:

Misc Example