0
我有以下文件
<link href="~/Content/Site.css" rel="stylesheet" />
<link href="~/Content/boostrap-min.css" rel="stylesheet" />
<link href="~/Content/themes/base/jquery-ui.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.12.4.min.js"></script>
<script src="~/Scripts/jquery-ui-1.12.1.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
然後,我有javascript函數
<script type="text/javascript">
$(document).ready(function() {
$(function() {
$("#txtSearch").autocomplete({
source: '@Url.Action("MerrBarkodet","Produktet")'
});
});
});
</script>
但不工作時,示值誤差 未捕獲TypeError:$(...)。自動完成不是函數
@using (Html.BeginForm("Index", "Produktet", FormMethod.Get, new { @class = "navbar-form navbar-left" }))
{
<div class="form-group">
<b>Search:</b>@Html.TextBox("search", null, new { id = "txtSearch" })
<input class="btn btn-default" type="submit" value="Search" />
</div>
}
能否請您確認的jQuery-UI-1.12.1.min.js'是否是''你$(文件).ready'功能之前加載? –
@GuruprasadRao任何作爲文檔就緒的回調,只有在完成頁面加載後纔會執行。排除阿賈克斯負載 –
#Sagar V ..如果jqueryui是404無所謂... – Pogrindis