Home > Web Front-end > JS Tutorial > body text

Detailed explanation of how jquery plug-in tablesorter implements html table usage examples

伊谢尔伦
Release: 2017-07-22 09:56:50
Original
2464 people have browsed it

tablesort is a very useful jQuery table sorting plug-in. It supports sorting of multiple data types and will automatically identify the data type of table content, making it very convenient to use.

Use jQuery tablesort to implement the html table method:

1. Download jQuery and tablesort scripts, and reference the script file in html:



Copy after login

2. Format the html table that needs to be sorted:

a. Specify the CCS class for the table that needs to be sorted: class="sort-table"
b. Use thead and tbody tags to mark the table header and table body
c. In the table header thead, you need to use the th tag to define the table header
The formatted html table is as follows:


Date Usage Cost Remain
2008-3-25 book place @dhgu -40 -40
2008-4-1 book place @dhgu -40 -80
Copy after login

3. Add jQuery code to enable html table sorting:
Call the tablesorter() function in the body on the sorted table css class specified in the second step:



Copy after login

Through the above 3 steps, jQuery tablesort can sort html tables.

The above is the detailed content of Detailed explanation of how jquery plug-in tablesorter implements html table usage examples. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!