对象不支持属性或方法“自动完成”
Object doesn't support property or method 'autocomplete'
@model IEnumerable<ModelClass.DhoniRegistry>
@using (@Html.BeginForm())
{
<b> Dhoni Name </b>
@Html.TextBox("SearchTerm", null, new { id = "txtSearch" })
<input type="submit" value="Search" />
}
<link href="~/Content/jquery-ui.min.css" rel="stylesheet" />
<link href="~/Content/jquery-ui.structure.min.css" rel="stylesheet" />
<link href="~/Content/jquery-ui.theme.min.css" rel="stylesheet" />
<script src="~/Scripts/external/jquery/jquery.js"></script>
<script src="~/Scripts/jquery-ui.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
$(function ()
{
$("#txtSearch").autocomplete({ source: '@Url.Action("ASDhoniName")' });
});
</script>
控制器
public JsonResult ASDhoniName(string SearchTerm)
{
DhoniRegistryBusinessSer dhoniBisSer = new DhoniRegistryBusinessSer();
List<string> dhoniReg;
dhoniReg = dhoniBisSer.ListDhoniRegistry().Where(x => x.DhoniName.StartsWith(SearchTerm))
.Select(y => y.DhoniName).ToList();
return Json(dhoniReg,JsonRequestBehavior.AllowGet);
}
您丢失/错误放置jQuery/ jQuery UI.js/ autocomplete.js
文件。此外,您还添加了两份jquery-ui
副本。删除一个。
这是包含文件的顺序
- jQuery.js
- jQuery UI .js
- 自动完成.js
在自动完成之前添加以下内容
<script src="http://code.jquery.com/jquery-1.9.1.js />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js" />
相关文章:
- 谷歌将部分页面加载后自动完成不起作用 ASP.Net MVC
- Ui自动完成不显示列表
- Codeigniter自动完成不起作用
- Jquery自动完成不是't工作.我做错了什么
- 自动完成不会'不起作用
- Netbeans 8.0.2 extjs 项目自动完成不起作用
- Jquery 谷歌自动完成不起作用 - 没有错误
- Jquery 自动完成不会在动态加载的部分视图中触发
- Jquery 自动完成不起作用
- ASP MVC 5 自动完成不起作用
- j查询自动完成不显示结果
- 自动完成不显示字符串数组
- JSFiddle - 为什么这个 JQuery 自动完成不起作用
- $(..).自动完成不是一个函数
- 谷歌's的自动完成不会'不要在第2页上工作
- jquery自动完成不响应动态插入的元素
- 自动完成不会'不起作用
- 自动完成不会't适用于具有相同id的两个元素
- 自动完成不是't工作
- 使用ajax源代码的jquery自动完成不会检索结果