我有这个函数使用jquery自动完成小部件,我得到了以下错误:0x800a01b6- JavaScript运行时错误:对象不支持我的html页面上的属性或方法‘自动完成’,在标题部分我包含了以下标签。
<script src="Scripts/jquery-1.10.2.min.js"></script>
<script src="Scripts/jquery-ui-1.11.4.min.js"></script>
这个函数被各种不同的选项按钮调用来执行几个不同的查询。我在另一个应用程序中有这个函数,它工作得很好,但在这里它不是。
function AutoComplete(Type) {
//create AutoComplete UI component
$("#txtCriteria").autocomplete({
source: function (request, response) {
$.ajax({
autoFocus: true,
async: false,
delay: 250,
url: "wsReports.asmx/AutoComplete",
data: "{'Type':'" + Type + "', 'filter':'" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.ACName,
value: item.ACCode
} // end of return
})) // end of response
} // end of success
}); // end of ajax
}, // end of source
select: function (event, ui) {
if (ui.item.value == "") {
alert("nothing to select");
}
else {
// prevent autocomplete from updating the textbox
event.preventDefault();
// manually update the textbox and hidden field
$(this).val(ui.item.label);
}
}, // end of select
change: function (event, ui) {
if (!ui.item) {
$(event.target).val('');
}
},
}) // end of txtCriteria.autocomplete
} // end of AutoComplete
你知道为什么在上述情况下它不被认可吗?
发布于 2016-05-19 14:12:20
是我的错。jquery.js和引导程序是在jquery-ui之后加载的。
https://stackoverflow.com/questions/37307368
复制