Check All Checkboxes with JQuery

Very often we need to check or uncheck check boxes at single click using js. If we are using javascript then we have to loop over an array to do so but by below example its been more easy and simple to use it.

Now Using jQuery we can easily do it and thats why i love it. we need only few lines of code for check or uncheck check boxes.

View Demo

[code:js] <script src="" type="text/javascript"></script>
<script>google.load("jquery", "1.3.2");</script>
var status = jQuery(this).attr(‘checked’);
this.checked = status;

Checked 1. Name and id of main checkbox.

2. Name of all checkboxes has to be checked.



I hope you may like it.