@H_404_0@<span style="background-color: #ccffcc">
如下所示:
<div class="jb51code">
<pre class="brush:js;">
//单击行勾选checkbox事件
$(document).on("click",".layui-table-body table.layui-table tbody tr",function () {
var index = $(this).attr('data-index');
var tableBox = $(this).parents('.layui-table-box');
//存在固定列
if (tableBox.find(".layui-table-fixed.layui-table-fixed-l").length>0) {
tableDiv = tableBox.find(".layui-table-fixed.layui-table-fixed-l");
} else {
tableDiv = tableBox.find(".layui-table-body.layui-table-main");
}
var checkCell = tableDiv.find("tr[data-index=" + index + "]").find("td div.laytable-cell-checkBox div.layui-form-checkBox I");
if (checkCell.length>0) {
checkCell.click();
}
});
$(document).on("click","td div.laytable-cell-checkBox div.layui-form-checkBox",function (e) {
e.stopPropagation();
});