The script
This script sorts tables (vertically) based on the data they contain. It is able to sort based on either lexical (text) or numeric content. Sorting can be based on the contents of any chosen column, and can use either ascending or descending order. It can be told to ignore heading rows, and rows with specific classes, and can also be told to sort only a specific table body instead of the whole table. Script runs in DOM browsers.
To download the script(s), see the script license, and check details like browser compatibility, use the links on the navigation panel at the top of this page.
Demo
Table | thead | row |
---|---|---|
Col 1 | Col 2 | Col 3 |
Foo | 0.5 | alpha |
Bar | 3.2 | beta |
This | has | class |
Baz | 7.6 | gamma |
Qux | n/a | delta |