如何在这个动态添加的文本框中添加自动完成?我用过这种方式$('#se').autocomplete(); ,但没有得到。
$(document).ready(function()
{
var counter = 2;
$("#addButton").click(function ()
{
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html(
'<input type="text" placeholder="Role" name="Role' + counter +
'" id="textbox' + counter + '" value="" > <input type="text"
placeholder="Search" name="search' + counter +
'" id="se" value="" > <input type="hidden" name="search' + counter +
'" id="se' + counter + '" value="" >');
newTextBoxDiv.appendTo("#TextBoxesGroup");
$('#se').autocomplete();
counter++;
});
<div id='TextBoxesGroup'>
<div id="TextBoxDiv1" class="form-inline control-group">
<%= text_field_tag('roles', nil,:id => 'textbox1')%>
<%= text_field_tag('search', nil,:id => 'se')%>
<%=hidden_field_tag(:id_search, value = "")%>
<input type='button' value='Add' id='addButton'>
</div>
</div>