我显然遗漏了一些东西,但是在尝试将自动完成添加到文本框时,我不断收到此消息:.autocomplete is not a function
_Layout(仅头部):
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.js" type="text/javascript"></script>
@Styles.Render("~/Content/themes/base/css", "~/Content/css")
@Scripts.Render("~/bundles/modernizr")
指数:
<script type="text/javascript">
$(function () {
$("#searchTerm").autocomplete({
source: "/Search/AutocompleteSuggestions",
minLength: 3,
select: function (event, ui) {
if (ui.item) {
$("#searchTerm").val(ui.item.value);
$("form").submit();
}
}
});
});
@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl }))'
{
<input id="searchTerm" name="searchTerm" type="text" />
<input type="submit" value="Go" />
}
我很确定 Jquery 插件没有正确加载,但我不明白为什么!