gpt4 book ai didi

jquery - 对象不支持属性或方法 'autocomplete'

转载 作者:行者123 更新时间:2023-12-01 00:40:35 24 4
gpt4 key购买 nike

添加一些自动完成代码后出现此错误。在网上搜索后,我确信它与重复的 jQuery 引用有关,但我只引用了一次。

应用程序使用母版页,但相关页面不使用它,因此我在两者中都引用了 jquery。

$(".autosuggest").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CustomerTypes.aspx/GetAutoCompleteData",
data: "{'Customer':'" + document.getElementById('txtCustomerType').value + "'}",
dataType: "json",
success: function(data) {
response(data.d);
},
error: function(result) {
alert("Error");
}
});
}
});

最佳答案

autocomplete()jQueryUI library 中的一个方法。 。您需要添加对该以及 jQuery.js 的引用:

<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>

关于jquery - 对象不支持属性或方法 'autocomplete',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19928826/

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