check uncheck checkboxes using jQuery

check uncheck checkboxes using jQuery

by Akram kamal

HTML

<p><input type="checkbox" id="chkAll" /> Check/Uncheck All</p>
<hr/>
<p>
<input type="checkbox" class="chk" /> Checkbox  1
<input type="checkbox" class="chk" /> Checkbox  2
<input type="checkbox" class="chk" /> Checkbox  3
</p>

<a target="_blank" href="http://www.sinppets.com/jquery/check-uncheck-all-checkboxes-using-jquery/">More Details</a>

JavaScript

$(document).ready(function(){
    $("#chkAll").click(function(){
        $(".chk").prop("checked",$("#chkAll").prop("checked"))
    }) 
});