I´ve been working with Jquery for a loooong time, so I will share some experiences.
Above an example how to select all checkboxes with one single checkbox.
It´s a very simple example an then you could made a lot of modifications.

html

<div>
<ul>
<li><input class="chkAll" type="checkbox" name="" value="all" /> Select All </li>
<li><input class="chk" type="checkbox" name="" value="1" /> item 1</li>
<li><input class="chk" type="checkbox" name="" value="2" /> item 2</li>
<li><input class="chk" type="checkbox" name="" value="3" /> item 3</li>
</ul>
</div>

js

$(".chkAll").click(function(){//remember that this will work in the element whith the class chkAll
if( $(this).is(':checked') ){
$(this).parent().parent().find(':checkbox').attr('checked', true);
}else{
$(this).parent().parent().find(':checkbox').attr('checked', false);
}
})

Subscribe to comments Comment | Trackback |
Post Tags: ,

Browse Timeline


Add a Comment


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


© Copyright 2007 Webmista Freetalkers. Thanks for visiting!

Starhost Hospedagem de Sites