簡體   English   中英

Document.ready在我的登錄頁面上不起作用

[英]Document.ready not working on my login page

因此,我有此登錄頁面(請參見下面的代碼), Document.ready無法正常工作。 腳本中有問題嗎? 我的代碼中是否有某些東西會使document.ready無法正常工作?

我試圖通過JavaScript中的警報消息進行檢查,但是它們從未被擊中。

@model OpenRoad.Web.Areas.Account.Models.LogOnModel
@using Combres.Mvc
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>@string.Format("{0} - {1}", OpenRoad.Web.ApplicationSettings.Title, "Logon")</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="/Content/images/favicon.ico" />

@Html.CombresLink("siteCss")
<link rel="stylesheet" type="text/css" href="@Url.Content("~/App_Themes/" +       OpenRoad.Web.ApplicationSettings.Theme + "/styles.css")" />    
 </head>
 <body class="login">

@{
     ViewBag.Title = "Log On";
}
@section scripts {
<script type ="text/javascript">
    $(document).ready(function () {
        alert('test');
        mixpanel.track("View Logon");
        if ($(".validation-summary-errors")[0]) {
            alert('Found with Length');
        };
    });
 }   
</script>

假設您的_Layout.cshtml具有以下內容:

     @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

將@section腳本更改為@section腳本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM