我想一個<table>
看起來像這樣內<tr>
元素進行排序:使用append()來排序列表
之前
<table>
<tbody>
<tr id="foo">...</tr>
<tr id="bar">...</tr>
<tr id="baz">...</tr>
<tr id="qux">...</tr>
</tbody>
</table>
假設我要到行,以便進行排序表變成這樣:
後
<table>
<tbody id="table">
<tr id="foo">...</tr>
<tr id="qux">...</tr>
<tr id="baz">...</tr>
<tr id="bar">...</tr>
</tbody>
</table>
我可以使用jQuery腳本序列做到這一點:
$('#table').append($('#qux'));
$('#table').append($('#baz'));
$('#table').append($('#bar'));
,但我想使腳本到一個,當我嘗試:
$('#table').append($('#qux,#baz,#bar'));
原始表,它似乎沒有任何效果。爲什麼這不起作用?有一種方法可以在一個命令中執行此操作嗎?
u能試試嗎? $('#table')。append($('#qux')+ $('#baz'));沒有嘗試,但猜測.. – sree 2013-05-01 08:16:46
http://stackoverflow.com/a/3160718/1104483 – 2013-05-01 08:26:46