0

在我的 MVC Web 应用程序中,我在布局页面中加载了一些脚本,因此它们可以在继承该布局的所有其他页面中使用。因为我使用的是来自 Kendo 和 Foundation 的东西,所以我也将他们的脚本作为包加载。

我在布局页面中的“head”部分如下所示:

<head>

<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>@ViewBag.Title | Inquéritos Online Sublime Software</title>
<link rel="shortcut icon" href="~/Content/images/admin-favicon.ico" type="image/x-icon" />

<link rel="stylesheet" type="text/css" href="~/Content/css/Site.css" />

@Styles.Render("~/Content/foundation/foundation.css")
@Styles.Render("~/Content/kendo/css")

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/foundation")
@Scripts.Render("~/bundles/kendo");

@RenderSection("head", required: false)
@* Use the Scripts section to define page specific scripts *@
@RenderSection("scripts", required: false)

<!-- Scripts -->
<script type="text/javascript" src="~/Content/scripts/scripts.js"></script>
<script type="text/javascript" src="~/Content/scripts/expand.js"></script>

<script> $(document).foundation(); </script>

</head>

您可能会注意到我在渲染 Kendo 包后有一个分号。奇怪的是:如果我保留那个不应该存在的分号,我所有的脚本都可以正常工作,但是我可以在页面中看到分号。另一方面,如果我删除那个分号,我的一些脚本就会停止工作。我在视图中定义的脚本,pe

我已经环顾四周了一段时间,但我不明白为什么会这样。任何想法?

编辑:

停止工作的脚本之一:

    $('body').on('click', '.apagar', function () {
        $(this).parents("div.editor-pergunta:first").remove();
        return false;
    });
4

0 回答 0