Let's say I have a table:
<table id="mytable"> <tr class="old_row"><td>1</td><td>2</td><td class="edit">Edit</td></tr> <tr class="old_row"><td>1</td><td>2</td><td class="edit">Edit</td></tr> <tr class="old_row"><td>1</td><td>2</td><td class="edit">Edit</td></tr> </table>
I want to click on the Edit cell and use jquery to replace the entire row with a new row with lots of content, e.g.
$(document).ready(function() { $('#mytable .edit').click( function() { var tr = $(this).parent(); var new_row = '<tr class="new_row"><td>3</td><td>4</td><td>Save</td></tr>'
Any idea how this can be done?
jquery table
Steve walsh
source share