Jquery 如何将选择复选框作为列添加到表中
这里有一个带有复选框的弹出窗口。当我根据在弹出窗口中的表2中显示的索引选择表1中的复选框时,这些索引应在弹出窗口表的外部添加as列 (弹出窗口有多个复选框,我必须选择几个复选框,然后单击提交按钮在表中添加列) 在我下面的代码中,添加到弹出表格之外的表格中,不使用按钮单击:Jquery 如何将选择复选框作为列添加到表中,jquery,Jquery,这里有一个带有复选框的弹出窗口。当我根据在弹出窗口中的表2中显示的索引选择表1中的复选框时,这些索引应在弹出窗口表的外部添加as列 (弹出窗口有多个复选框,我必须选择几个复选框,然后单击提交按钮在表中添加列) 在我下面的代码中,添加到弹出表格之外的表格中,不使用按钮单击: var cell = $(this).parent("td"); var row = $(cell).parent("tr"); var rowIndex = $('#popout th[id=' + thisId + ']'
var cell = $(this).parent("td");
var row = $(cell).parent("tr");
var rowIndex = $('#popout th[id=' + thisId + ']').index();
var columnIndex = (rowIndex);
var tblcolumnscount = $('#popout td').length;
if $('#popout td').length == 0) {
var colselect = 1;
$('#popout td,#tblKPLItemList th').addClass('hide');
$('#popout-l td,#tblKPLItemList-sticky th').addClass('hide');
$('#popout ,tblKPLItemList-sticky').removeClass('hide');
$('#popout td:nth-child(' + (colselect + 1) + '),#popout th:nth-child(' + (colselect + 1) + ')').removeClass('hide');
$('#popout-l td:nth-child(' + (colselect + 1) + '),#popout-l th:nth-child(' + (colselect + 1) + ')').removeClass('hide');
}
if (checked) {
var Fid = $(this).closest('table').attr('id');
if (Fid == 'ColumnsSelect') {
var Checkedrow = $(this).closest('tr').html();
$('#tblpopup2 tbody').append('<tr class="' + thisId + '">' + Checkedrow + '</tr>');
$("#tblpopup2 tbody input").attr("checked", "checked");
}
$('#popout td:nth-child(' + (columnIndex + 1) + '),.display th:nth-child(' + (columnIndex + 1) + ')').removeClass('hide');
$('#popout-l td:nth-child(' + (columnIndex + 1) + '),#popout-l th:nth-child(' + (columnIndex + 1) + ')').removeClass('hide');
var cell=$(this.parent(“td”);
变量行=$(单元格).parent(“tr”);
var rowIndex=$('#popout th[id='+thisId+'])。index();
var columnIndex=(rowIndex);
var tblcolumnsunt=$('popout td')。长度;
如果$('#popout td')。长度==0){
var colselect=1;
$('popout td,'tblKPLItemList th').addClass('hide');
$('popout-ltd,'tblkplitemlistch').addClass('hide');
$('popout,tblkplitemlisticky').removeClass('hide');
$(“#popout td:n个子级(“+(colselect+1)+”),#popout th:n个子级(“+(colselect+1)+”)。removeClass('hide');
$('#popout-l td:n子级('+(colselect+1)+'),'#popout-l第n子级('+(colselect+1)+'))。removeClass('hide');
}
如果(选中){
var Fid=$(this).closest('table').attr('id');
如果(Fid=='列选择'){
var Checkedrow=$(this.closest('tr').html();
$('#tblpopop2 tbbody')。追加(''+Checkedrow+');
$(“#tblpopop2 tbody input”).attr(“选中”、“选中”);
}
$(“#弹出td:n个子(“+(columnIndex+1)+”),.display th:n个子(“+(columnIndex+1)+”)。removeClass('hide');
$('#popout-l td:n子级('+(columnIndex+1)+'),'#popout-l第n子级('+(columnIndex+1)+'))。removeClass('hide');
你能提供一把小提琴吗?我在小提琴里找不到任何html代码。。