I have the following script which works as long as #txtAllowSearch is flat html:
$(document).ready(function(){
$("#txtAllowSearch").autocomplete({
source: "test_array.aspx",
delay: 0,
select: function (event, ui) {
$("#txtAllowSearch").val(ui.item.value); // display the selected text
$("#txtAllowSearchID").val(ui.item.id); // save selected id to hidden input
}
});
});
This stops working as soon as #txtAllowSearch is dynamically created by javascript/jquery.
Do I need to use jqueries live to get this to work?
jQuerys
.live()help //.delegate()help only catch events. In your case (applying a plugin method on an element), you would need to call.autocomplete()each time after the element was inserted into the DOM, or use the excellent.livequeryhelp plugin.