JQuery check uncheck all checkboxes

For example, JQuery check uncheck all checkboxes...

Demo

Checkboxes:



HTML

<form action="#">
    <label><input type="checkbox" id="check-all-checkboxes"/>Check all</label>
    <fieldset>
        <legend>Checkboxes:</legend>
        <label><input type="checkbox" />Html5</label>
        <br>
        <label><input type="checkbox" />CSS3</label>
        <br>
        <label><input type="checkbox" />JavaScript</label>
        <br>
        <label><input type="checkbox" />jQuery</label>
    </fieldset>
</form>

Jquery

$("#check-all-checkboxes").change(function () {
    $("input:checkbox").prop('checked', $(this).prop("checked"));
});
  • Share
  • Copyright 2016 by WebiBeris.com. All Rights Reserved.