[英]Uncaught Type Error: Undefined is not a function JavaScript
In the script section, i get the Uncaught Type Error: Undefined is not a function JavaScript error. 在脚本部分,我得到了Uncaught Type Error:Undefined不是JavaScript函数错误。 What might be wrong? 可能是什么问题? I checked to see if the .js files have been called, and everything is in order. 我检查是否已调用.js文件,并且一切正常。
@model Crux.Models.Question
@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="~/Content/jquery.tagit.css" rel="stylesheet" />
<script src="~/Scripts/jquery-2.1.1.min.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<script src="~/Scripts/tag-it.js"></script>
<link href="~/Content/jquery-ui.min.css" rel="stylesheet" />
<h2>Create</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Question</h4>
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(model => model.question, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.question)
@Html.ValidationMessageFor(model => model.question)
</div>
</div>
<div class="form-group">
<label for="hashtags" class="control-label col-md-2">Tags</label>
<div class="col-md-10">
<input id="hashtags" name="hashtags" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#hashtags").tagit({
allowSpaces: false,
singleField: true,
singleFieldNode: $('#hashtags'),
availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"]
});
});
</script>
It gives the error on line: $("#hashtags").tagit({
它在以下行给出错误: $("#hashtags").tagit({
I was clashing jQuery by loading it three different times. 我通过加载三个不同的时间来冲突jQuery。 from bundles and the page itself. 从包和页面本身。 removed all the links, and finally worked. 删除了所有链接,终于工作了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.