jquery插入了一个新行

jquery插入了一个新行,jquery,Jquery,当用户按下文本“Add”时,我想创建一个带有输入标记的新行。我想我大部分时间都在工作 <!DOCTYPE HTML> <html> <head> <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> function OnLoad() { $('.insert').live('click', functi

当用户按下文本“Add”时,我想创建一个带有输入标记的新行。我想我大部分时间都在工作

<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<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>

函数OnLoad(){
$('.insert').live('click',function()){
var currentRow=$(this).parents(“tr:first”);
var newRow=currentRow.clone(true);
//此处需要帮助:将第三个表数据更改为输入控件
currentRow.after(newRow);
});
}
load(“jquery”,“1”);
setOnLoadCallback(OnLoad);
添加
擦除
样本数据在这里
像这样:

newRow.children('td:last').empty().append('<input>Whatever</input>');
newRow.children('td:last').empty().append('Whatever');
像这样:

newRow.children('td:last').empty().append('<input>Whatever</input>');
newRow.children('td:last').empty().append('Whatever');