国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery排序插件tableSorter使用方法

Original 2017-02-16 11:58:24 1272
abstract:本文實(shí)例為大家分享了jQuery排序插件tableSorter的使用方法,供大家參考,具體內(nèi)容如下1.先引兩個(gè)js<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script> <script type="t

本文實(shí)例為大家分享了jQuery排序插件tableSorter的使用方法,供大家參考,具體內(nèi)容如下

1.先引兩個(gè)js

<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../js/jquery.tablesorter.min.js"></script>

注意:表格要用thead/th和tbody。如:

<table id="myTable">
<thead>
<tr>
  <th>Last Name</th>
  <th>First Name</th>
  <th>Email</th>
  <th>Due</th>
  <th>Web Site</th>
</tr>
</thead>
<tbody>
<tr>
  <td>Smith</td>
  <td>John</td>
  <td>jsmith@gmail.com</td>
  <td>$50.00</td>
  <td>http://www.jsmith.com</td>
</tr>
<tr>
  <td>Bach</td>
  <td>Frank</td>
  <td>fbach@yahoo.com</td>
  <td>$50.00</td>
  <td>http://www.frank.com</td>
</tr>
</tbody>
<table>

   

3.調(diào)用排序js代碼

<script type="text/javascript">
$(document).ready(function() {
  $("#mytable").tablesorter();
});
</script>

再回到頁(yè)面點(diǎn)擊第一行就可以進(jìn)行排序了.

ps:

  1.一定要引jQuery包,所有jq插件都是基于jQuery包的

  2.如果想指定哪一欄不排序這樣寫

    $("#mytable").tablesorter({headers:{5:{sorter:false}}});

  第5列的sorter為false就OK了

更多關(guān)于jQuery排序插件tableSorter使用方法請(qǐng)關(guān)注PHP中文網(wǎng)(m.miracleart.cn)其他文章!

Release Notes

Popular Entries