tags:

views:

31

answers:

1

When the user presses the text "Add", then I'd like to create a new row with an input tag. I think I've got most of it working.

<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
<script type="text/javascript">
function OnLoad() {
    $('.insert').live('click', function() {
        var currentRow = $(this).parents("tr:first");
        var newRow = currentRow.clone(true);
        // Help need here: change the 3rd table data into an input control
        currentRow.after(newRow);
    });
}
google.load("jquery", "1");
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<form>
<table border="1">
<tr>
<td class="insert">Add</td>
<td class="delete">Erase</td>
<td>Sample data goes here</td>
</tr>
</table>
</form>
</body>
</html>
+3  A: 

Like this:

newRow.children('td:last').empty().append('<input>Whatever</input>');
SLaks
Thanks! This has gotten me started.
cf_PhillipSenn