leodutra
10/28/2013 - 6:15 PM

Select all/ deselect all functionality using jQuery

Select all/ deselect all functionality using jQuery

selectAll = function(name) {
	var $el = $('[name="'+ name +'"]');
	$el.filter(':checkbox').attr('checked', 'checked');
	$el.filter('select').children('option').attr('selected', 'selected');
}

deselectAll = function(name) {
	var $el = $('[name="'+ name +'"]');
	$el.filter(':checkbox').removeAttr('checked');
	$el.filter('select').children('option').removeAttr('selected');
}