Return to Snippet

Revision: 45525
at May 3, 2011 06:39 by diogoweb


Initial Code
<div class="options">
	<ul>
		<li><a href="#" class="select-all">Select All</a></li>
		<li><a href="#" class="reset-all">Reset All</a></li>
	</ul>

	<input type="checkbox" id="option1" /><label for="option1">Option 1</label>
	<input type="checkbox" id="option2" /><label for="option2">Option 2</label>
	<input type="checkbox" id="option3" /><label for="option3">Option 3</label>
	<input type="checkbox" id="option4" /><label for="option4">Option 4</label>
</div>
$('.select-all').live('click', function(){
	$(this).closest('.options').find('input[type=checkbox]').attr('checked', true);
	return false;
});

$('.reset-all').live('click', function(){
	$(this).closest('.options').find('input[type=checkbox]').attr('checked', false);
	return false;
});

Initial URL
http://eisabainyo.net/weblog/2010/09/01/10-useful-jquery-snippets/

Initial Description

                                

Initial Title
Check/Uncheck all checkboxes

Initial Tags

                                

Initial Language
jQuery