javascript icon
4th
Feb 10

Checking (and unchecking) all Checkboxes with JQuery

Posted Thursday 4th February 2010

If you wish to check (tick) or uncheck (untick) all checkboxes with JQuery use the find, each and attr functions. This will loop through every checkbox element and set the attribute you want.

Example of checking every checkbox:

1
2
3
$("#div").find("input[type='checkbox']").each(function(){
                $(this).attr('checked', true);
         });

Bookmark or share this page:

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Related posts:

  1. jQuery: Set the default selected OPTION of a HTML SELECT list


MSN Contact: contact [at] danielgibbs.net



No Comments

No comments yet.

TrackBack URL

Leave a comment