javascript - Move Rows up and down in html table -


possible duplicate:
swapping rows in jquery

how move rows , down in table on button click?

try using jquery. can like:

<table id="mytable">     <tr>         <td>row 1</td>         <td><input type="button" value="move up" class="move up" /></td>         <td><input type="button" value="move down" class="move down" /></td>     </tr>     ... </table>  $('#mytable input.move').click(function() {     var row = $(this).closest('tr');     if ($(this).hasclass('up'))         row.prev().before(row);     else         row.next().after(row); }); 

look @ working here.

you can try jquery's sortable, much easier.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -