我有一個具有不同值的選項列表。我聽我的名單使用的事件:http://www.kryogenix.org/code/browser/sorttable/使用的SortTable:.append從函數內部創建可排序的表格
value = $('#list option:select').val();
我那麼像這樣
if (value == 'a') {
$('table').contents(); //clear content
$('table').append(
'<table class="sortable">
<thead>
<tr>
<th class="">Name</th>
<th class="">Unit1</th>
<th class="">Unit2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Fitz, Marvin</td>
<td>$3300</td>
<td>5554</td>
</tr>'); //add content
} else if (value == "b" {
$('table').contents(); //clear content
$('table').append(<new table>);
要做到這一點,我下進行基於價值不同的動作。 js作爲腳本源。
表更新完美,但似乎不受sorttable.js影響。給定函數內的.append發生的事情(或出於任何其他原因),我是否必須以不同於正常情況的方式處理它?