1、点击行选中checkbox复选框
//点击行勾选$("#Qub_tb_List").on("click", "tr", function () { ???var input = $(this).find("input"); ???if ($(input).val() == "on") { ???????return; ???} ???$("#Qub_tb_List *").not(input).prop("checked", false); ?//点击行,只能选择一行 ???if (!$(input).prop("checked")) { ???????$(input).prop("checked", true); ???} else { ???????$(input).prop("checked", false); ???}});
2、全选功能
//多选框 防止事件冒泡$("#Qub_tb_List").on("click", "input", function (event) { ???event.stopImmediatePropagation();});//全选功能$("input[name=‘all_check‘]").change(function () { ??if (this.checked) { ???$("input[name=‘check_tr‘]:checkbox").each(function () { ???????this.checked = true; ?????}) ??} else { ????$("input[name=‘check_tr‘]:checkbox").each(function () { ????this.checked = false; ?????}) ??} ?});
js点击行选中checkbox
原文地址:http://www.cnblogs.com/xinbaba/p/7782904.html