Here is the Jquery for sorting table data. I used first column which holds numbers. You have to modify **column index and condition statement** as per your requirements. I hope that solves your problem... $(document).ready(function(){ // Table data sorting starts.... $('input#short_data').click(function(){ //Data table object $dataTable = $('table#data_table'); //Data table row length $dataRows = $dataTable.find('tr').length; //Data table short column index $sortColumn = 0; // Outer loop for N-1 times for(var i = 0; i < parseInt($dataRows) - 1; i++){ // Inner loop for rest of unsorted list for(var j = 0; j < ( parseInt($dataRows) - i - 1); j++){ // read (j)th and (j+t) rows $firsRow = $dataTable.find('tr').eq(j); $secondRow = $dataTable.find('tr').eq(j+1); //if (j)th row is greater than (j+1)th. if( parseInt( $firsRow.find('td').eq($sortColumn).text() ) > parseInt( $secondRow.find('td').eq($sortColumn).text() ) ){ // Swap rows.... $firsRow.insertAfter($secondRow); } } //End of inner loop } //End of outer loop }); // Table data sorting ends.... }); HTML Table: <table id="data_table" width="200" border="1"> <tr> <td width="100">01</td> <td>aaa</td> </tr> <tr> <td>04</td> <td>ddd</td> </tr> <tr> <td>05</td> <td>eee</td> </tr> <tr> <td>03</td> <td>ccc</td> </tr> <tr> <td>02</td> <td>bbb</td> </tr> <tr> <td>06</td> <td>fff</td> </tr> </table> HTML Table: Sorted <table id="data_table" width="200" border="1"> <tr> <td width="100">01</td> <td>aaa</td> </tr> <tr> <td>02</td> <td>bbb</td> </tr> <tr> <td>03</td> <td>ccc</td> </tr> <tr> <td>04</td> <td>ddd</td> </tr> <tr> <td>05</td> <td>eee</td> </tr> <tr> <td>06</td> <td>fff</td> </tr> </table>