I am using a jQuery plugin (autocomplete) here http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ and I am adding dynamic text fields to a page which require the autocomplete feature.
Each text field has the same class and if possible would like to use the class i.e.
$(".liveSearchSuburb").autocomplete();
How would I go about re-init the plugin?
$("#btnAddAnotherLocation").live("click", function(){
cloneIndexLocation++;
$("#clonedInputLocation0").clone()
.appendTo("#clonedInputsLocation")
.attr("id", "clonedInputLocation" + cloneIndexLocation)
.find("*").each(function(){
var id = this.id || "";
var match = id.match(regex) || [];
if(match.length == 3){
this.id = match[1]+(cloneIndexLocation);
}
}).end();
$("#clonedInputLocation" + cloneIndexLocation).css("display", "inline");
});
For re-initializing autocomplete you could do something like:
("#textField").unbind().autocomplete("get_list.php", {...});Check for ref: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/