Posted By

dnnsldr on 08/23/12


Tagged

jquery checkboxes checkall


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

yusege
ringo380


jQuery "Check All"


 / Published in: JavaScript
 

URL: http://briancray.com/posts/check-all-jquery-javascript

How does it work?

This code checks/unchecks all checkboxes within the same fieldset. Simple and semantic. HTML Setup

Add checkboxes however you like, just make sure they are within the same fieldset.

Check all Checkbox Checkbox Checkbox

Checkbox Checkbox Checkbox

  1. $(function () {
  2. $('.checkall').click(function () {
  3. $(this).parents('fieldset:eq(0)').find(':checkbox').attr('checked', this.checked);
  4. });
  5. });

Report this snippet  

You need to login to post a comment.