#
//擷取選中項
$('#submit').click(function () {
var check_list = []
$("input[name='ck']:checked").each(function () {
check_list.push(this.value);
});
alert(check_list.join(","));
});
//全選/取消全選
$('#all').toggle(function () {
$("input[name='ck']").attr("checked", 'true');
}, function () {
$("input[name='ck']").removeAttr("checked");
});
//反選
$('#unselected').click(function () {
$("input[name='ck']").each(function () {
if ($(this).attr("checked")) {
$(this).removeAttr("checked");
} else {
$(this).attr("checked", 'true');
}
});
});
#
轉載于:https://www.cnblogs.com/weiok/p/5118482.html