简体   繁体   中英

Jquery not loading ASP.NET

I want to start learning jquery/jquery ui but I seem to be stuck at the most basic step; getting it to load. I've tried with 3 different versions and none of them are working.

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. I've tried with versions from normal jquery site aswell.

When I load page:

在此处输入图片说明

Im trying to run just a simple test in 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 . jQuery use $(document).ready() for this like.

<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. Keep in mind to put this code after where you have loaded the jQuery file.

Check for jQuery UI

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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