| 1 | 1 | 1 | 1 | 1 | |
| 2 | 2 | 2 | 2 | 2 | |
| 3 | 3 | 3 | 3 | 3 |
| 第一列 | 第二列 | 第三列 | 第四列 | 第五列 |
tr,td {
border:1px solid black;
width:100px;
height:50px;
padding:5px;
text-align:center;
}
table {
border-collapse:collapse;
}
点击上面表格某行前的选择框,将该行复制到下面的表格中。
$(document).ready(function() {
var $cb_fruit = $(".cb_fruit");
$(".cb_fruit").click(function() {
$("tr").remove('.tb2-tr'); //把表格内容都去掉
$cb_fruit.each(function() {
if ($(this).get(0).checked) {
$("#tb2").append('<tr class="tb2-tr">' + $(this).parents("tr").html() + '</tr>'); //添加表格内容
}
})
})
})
$(".show_tab_val").each(function() {
$that = $(this);
$element_checked.each(function() {
$that.append('<td>' + $(this).text() + '</td>');
//遍历 将里面的值给div
});
回复