Easy sortable HTML tables using jQuery
Published
I made a little jQuery script that makes it really easy to enable sorting on a HTML table.
Features
- Really easy to set up
- Can sort on load if a header is specified otherwise assumes that the first column is already sorted
- Keyboard accessible
- Adds
titleattributes automatically to eachth - CSS arrow to signify ascending or descending
How to use
- Create a
tableusingtbodytags for content andthfor headers - Add
sortableclass to the table - (Optional) Specify a
thto be sorted when the document is ready by adding the classsortedorsorted descfor descending