【发布时间】:2014-01-09 11:59:11
【问题描述】:
HTML
<table>
<tr>
<td>Col</td>
<td>:</td>
<td>
<input type="text" name="" class="check-input" />
<span class="error-input"></span>
</td>
<td><button class="add-input">Click</button></td>
</tr>
</table>
JQUERY
$('.add-input').on('click',function(){
$(this).closest('tr').after('<tr><td>Col</td><td>:</td><td><input type="text" name="" class="check-input" /><span class="error-input"></span></td><td></td></tr>');
});
$('.check-input').on('change',function(){
$(this).next().text('Error');
});
我无法将事件绑定到动态创建的元素。我该怎么做?
【问题讨论】:
标签: jquery