天道酬勤,学无止境

tablesort

Select and sort a column in a table using Javascript

I want to select a particular column of a table and sort it accordingly using Javascript (No frameworks or plugins). Could anyone help me regarding this? <table> <thead> <tr> <td>Col1</td> <td>Col2</td> <td>Col3</td> <td>Col4</td> </tr> </thead> <tbody> <tr> <td>Data11</td> <td>Data23</td> <td>Data53</td> <td>Data45</td> </tr> <tr> <td>Data81</td> <td>Data42</td> <td>Data33</td> <td>Data4854</td> </tr> <tr> <td>Data84681</td> <td>Data452</td> <td>Data354</td> <td>Data448</td> </tr> <tr> <td>Data1846</td> <td>Data25635</td> <td>Data3232</td> <td>Data44378</td> </tr> </tbody> </table>

2021-06-26 23:44:52    分类:问答    javascript   html   arrays   html-table   tablesort