简体   繁体   English

jQuery未加载ASP.NET

[英]Jquery not loading ASP.NET

I want to start learning jquery/jquery ui but I seem to be stuck at the most basic step; 我想开始学习jquery / jquery ui,但是似乎停留在最基本的步骤上。 getting it to load. 加载它。 I've tried with 3 different versions and none of them are working. 我尝试了3种不同的版本,但都没有用。

In my masterpage: 在我的主页中:

<link href="Content/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="Content/css/jquery-ui.min.css" rel="stylesheet" />

<script src="Scripts/jquery.js"></script>
<script src="Scripts/jquery-ui.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>

All of the jquery is from jquery UI download. 所有的jquery都是从jquery UI下载的。 I've tried with versions from normal jquery site aswell. 我也尝试过来自普通jquery网站的版本。

When I load page: 当我加载页面时:

在此处输入图片说明

Im trying to run just a simple test in html: 我试图在html中运行一个简单的测试:

<input type="text" name="date" id="date"/>

Script: 脚本:

<script type="text/javascript">
    $(document).ready(function() {  
        $("#date").datepicker();
    });
</script>

A page can't be manipulated safely until the document is ready . 在文档ready之前,无法安全地操作页面。 jQuery use $(document).ready() for this like. jQuery使用$(document).ready()这样。

<script src="Scripts/jquery.js"></script>
<script src="Scripts/jquery-ui.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<script>
$(document).ready(function(){

            $("#date").datepicker();
});  
</script>

If it still does not work.. Use 如果仍然无法使用,请使用

  if (typeof jQuery != 'undefined') {

        alert("jQuery library is loaded!");

    }else{

        alert("jQuery library is not found!");

    }

to check whether is jQuery is loaded or not. 检查是否已加载jQuery。 Keep in mind to put this code after where you have loaded the jQuery file. 请记住,在加载jQuery文件之后放置此代码。

Check for jQuery UI 检查jQuery UI

if (typeof jQuery.ui != 'undefined') {
  alert("UI loaded");
}
else alert("UI NOT LOADED");

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

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