$(function() {
$(“#select”).click(function() {
if ($(this).attr(“checked”)) {
$(“input[name=items]”).each(function() {
$(this).attr(“checked”, true);
});
} else {
$(“input[name=items]”).each(function() {
$(this).attr(“checked”, false);
});
}
});
//得到选中的值,ajax操作使用
$(“#submit”).click(function() {
var text=””;
$(“input[name=items]”).each(function() {
if ($(this).attr(“checked”)) {
text += “,”+$(this).val();
}
});
alert(text);
});
});