繁体   English   中英

未捕获的类型错误:未定义不是函数JavaScript

[英]Uncaught Type Error: Undefined is not a function JavaScript

在脚本部分,我得到了Uncaught Type Error:Undefined不是JavaScript函数错误。 可能是什么问题? 我检查是否已调用.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>

它在以下行给出错误: $("#hashtags").tagit({

我通过加载三个不同的时间来冲突jQuery。 从包和页面本身。 删除了所有链接,终于工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM