读书人

应用jquery的tablesorter插件进行表格

发布时间: 2013-03-10 09:38:39 作者: rapoo

使用jquery的tablesorter插件进行表格排序

tablesorter的官方网站: http://tablesorter.com/docs/

使用方法:

1.下载tablesorter http://tablesorter.com/__jquery.tablesorter.zip

2.解压文件,将jquery和jquery.tablesorter.min.js导入到项目文件中

3.修改html:

1)添加链接

<script type="text/javascript" src='/pagemedia/js/jquery.tablesorter.min.js'></script><script type="text/javascript" src='/pagemedia/js/jquery.min.js'></script>


2)修改表格

<table id="myTable"  class='tablesorter'>

为table添加id和class,class为tablesorter.(注意:table必须有thead和tbody)

3)添加javascript脚本:

<script>$(document).ready(function(){     $("#myTable").tablesorter();      });</script>



ok!完成

读书人网 >编程

热点推荐