如何在行中显示数据看起来像列

时间:2017-07-18 10:58:56

标签: jquery html css

My broken function

对不起,我的英语很糟糕。

如何将第一行中数据单元格的末尾移动到第二列的第一行。在添加功能中,它只添加tbody< td>例子< td>所以它只出现在第一行和任何想法看起来像在Image bottom one is now want to looks like top one的顶部?

$(".chkbox").click(function(){
  var value = $(this).val(),$list=$("#tablebody");
  if(this.click){
    $list.append("<td data-value='"+ value + "'>"+ value + "</td>")
    $(this).remove();       
  }
});

1 个答案:

答案 0 :(得分:0)

$(".chkbox").click(function() {
var value = $(this).val(),
Idans = $(this).attr('id'),
$list = $("#tablebody"),
$lastRow = $list.find("tr").last(),
if ($lastRow.length === 0 || $lastRow.find("td").length >= columnCount) {
$lastRow = $("<tr></tr>").appendTo($list)
}
$lastRow.append("<td data-value='" + value + "'>" + "<b>" + value + " Id = " +Idans  + "</b>" + "</td>")
$(this).remove();
})

从这个可能需要未来猜测的人那里得到了答案

相关问题