[jQuery] Is it possible to sort columns by a row using jQuery

[jQuery] Is it possible to sort columns by a row using jQuery


for example when row two is clicked I would like the table to reorder
a, b, c, d
<table>
<tr>
<td>col 1</td>
<td>col 2</td>
<td>col 3</td>
<td>col 4</td>
</tr>
<tr>
<td>b</td>
<td>a</td>
<td>d</td>
<td>c</td>
</tr>
<tr>
<td>z</td>
<td>x</td>
<td>y</td>
<td>w</td>
</tr>
</table>