【发布时间】:2014-08-10 21:43:36
【问题描述】:
我有一个处理名为选项的文本输入的表单部分。
默认情况下,我提供两个选项。单击最后一个时,我想再添加一个选项字段。
<input type='text' name='options[]' class='options'>
<br/>
<br/>
<input type='text' name='options[]' class='options'>
我试过了
$(".options:last").click(function(){
$("#options").append("<br/><br/><input type='text' name='options[]' class='options'>");
})
第一次确实有效。但在那之后不起作用。它不考虑 jquery 添加的输入。所以它只有在我点击第二个选项时才有效。不是 jquery 添加的最后一个。该怎么做?
【问题讨论】:
标签: javascript jquery forms text input