0
HTML起作用動態創建tr和添加行數計數
<tbody class="list">
<tr>
<td class="id">1</td>
<td class="name">jason</td>
<td class="number">2</td>
<td class="edit"><button class="edit__item">Edit</button></td>
<td class="remove"><button class="remove__item">Remove</button></td>
</tr>
</tbody>
功能
function catchList() {
var tr;
$('#list tr').each(function(index, tr) {
$('td:not(.id,.edit,.remove)', tr).each(function() {
var textvalue = $(this).text();
tr = $('<tr/>');
tr.append("<td>" + textvalue + "</td>");
$('.displayTable__list').append(tr);
});
});
}
顯示的html
<div class="dataDisplay__list">
<table class="teamList__displayTable">
<thead>
<tr class="displayTable__header">
<th>Name</th>
<th>Number</th>
</tr>
</thead>
<tbody class="displayTable__list">
//create those list at here
</tbody>
</table>
</div><!-- end of dataDisplay__list -->
第一是就1列2創建數計數3.
2nd如何將其排隊可能使用表?
ia表我必須得到所有內部tr值到另一個表(顯示),所以我使用函數來獲取所有值並將它們追加到顯示錶中,但我有問題排隊和我我如何在行上創建數字?我的意圖是這樣的。
名稱編號
1.jason 2
沒有任何HTML可以通過它創建自己的行號? –
不,據我所知,沒有自動附加數字的html –