jquery checkbox 多选/反选 插件
View Code
(function($) {
$.fn.MultiCheck = function(options) {
settings = $.extend({
groupName: '',
checked: true
}, options || {});
var groupTarget = (settings.groupName == '') ? ':checkbox' : 'input[name=' + settings.groupName + ']';
switch (settings.checked) {
case true:
$(groupTarget).each(function() { this.checked = true; });
break;
default:
$(groupTarget).each(function() { this.checked = false; });
break;
}
};
$.fn.MultiCheck = function(options) {
settings = $.extend({
groupName: '',
checked: true
}, options || {});
var groupTarget = (settings.groupName == '') ? ':checkbox' : 'input[name=' + settings.groupName + ']';
switch (settings.checked) {
case true:
$(groupTarget).each(function() { this.checked = true; });
break;
default:
$(groupTarget).each(function() { this.checked = false; });
break;
}
};