我想使用jQuery和html制作动态表。基本上,它所做的是,从输入的文本中追加一个新行,其中包含一个单元格的文本和另一个单元格中的删除按钮。但我的问题是,输入的点击事件没有触发。这里有添加和删除行动态生成的输入不工作
//Remove Row
$('.remove-row').click(function() {
alert('Works!');
});
//Add Row
$('.add-other-sources').click(function() {
var $text=$(this).parent().parent().find('.other-sources-input');
var $table=$(this).parent().parent().parent().find('.other-sources-table')
$('<tr><td>'+$text.val()+'</td><td><input type="button" class="remove-row" value="x"/></td></tr>').fadeIn('slow').appendTo($table);
$text.val("");
});
从我能想出的网络检查的脚本,输入的标签显示了这样<input type="button" class="remove-row" value="x">
。这与删除行事件不起作用有什么关系?
有没有人有任何想法如何解决这个问题?在此先感谢
工程就像一个魅力。谢谢! – 2013-05-13 22:50:48