gpt4 book ai didi

jquery 自动完成动态文本字段

转载 作者:行者123 更新时间:2023-12-01 06:03:54 25 4
gpt4 key购买 nike

我在这里使用 jQuery 插件(自动完成)http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/我正在向需要自动完成功能的页面添加动态文本字段。

每个文本字段都有相同的类,如果可能的话希望使用该类,即

$(".liveSearchSuburb").autocomplete();

我该如何重新初始化插件?

$("#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");
});

最佳答案

要重新初始化自动完成功能,您可以执行以下操作:

("#textField").unbind().autocomplete("get_list.php", {...});

检查引用号:http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/

关于jquery 自动完成动态文本字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8462772/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com