I'm trying to make autocomplete in appended field. Example:
-
I add dynamic fields to the form by clicking link with id="add_field"
var counter = 0; $(function(){ $('a#add_field').click(function(){ counter += 1; $('#container').append( '<input id="field_' + counter + '" name="dynfields[]' + '" class="name" type="text" /><br />' ); }); });
-
make field autocomplete
$(document).ready(function(){ $("input[class=name]").autocomplete({ source:'searches/product_autocomplete.php', minLength:2 }); });
However it does not do autocomplete.
I have tried this in a static field with class="name" and it works. But it does not work in dynamic fields.