This code is selected from many jQuery check box function codes. The code used in my project is shared with everyone here.
$(function(){
$("#checkedAll").click(function(){
$('[name=items]:checkbox').attr('checked',true);
});
$("#checkedNo").click(function(){
$('[name=items]:checkbox').attr('checked',false);
});
$("#checkedRev").click(function(){
$('[name=items]:checkbox').each(function(){
//$(this).attr('checked',!$(this).attr('checked'));
This.checked = !this.checked;
});
});
$("#send").click(function(){
Var Str = "What you choose is:
n";
$('[name=items]:checkbox:checked').each(function(){
str = $(this).val() "rn";
});
alert(str);
});
});
Friends, is it very convenient to use? This is what I have chosen. I hope it can be helpful to everyone.