Hi guys,
I have table rows here,
<tbody>
<tr id="1"><td>1</td> <td>One</td> <input type="hidden" name="lesson" id="lessonid33" value="1" /></tr>
<tr id="2"><td>2</td> <td>Two</td> <input type="hidden" name="lesson" id="lessonid34" value="2" /></tr>
<tr id="3"><td>3</td> <td>Three</td> <input type="hidden" name="lesson" id="lessonid11" value="3" /></tr>
<tr id="4"><td>4</td> <td>Four</td> <input type="hidden" name="lesson" id="lessonid21" value="4" /></tr>
<tr id="5"><td>5</td> <td>Five</td> <input type="hidden" name="lesson" id="lessonid37" value="5" /></tr>
<tr id="6"><td>6</td> <td>Six</td> <input type="hidden" name="lesson" id="lessonid40" value="6" /></tr>
</tbody>
As you can see it has <input> hidden field.
The lessonids are unique to each <tr> the value is in ascending order (and must be always in ascending order).
For example If I move lessonid40 over lessonid33, the value of lessonid40 will become 1 since it is the first table row.
And the value of lessonid33 will become 2 and lesson34 will become3 and so on…
How to do this function that will re-order the value of each table row in ascending order using jQuery, every time I reposition/move a table row?
Thanks in advance.