Uncaught TypeError: undefined is not a function in datepicker

I am trying to use jquery date picker in mvc4.

This was giving me an error:

Uncaught TypeError: undefined is not a function

      

My jQuery function is like:

$(document).ready(function () {
    $('#dpFrom').datepicker();
});

      

html part is like:

 <input type="text" id="dpFrom"  />

      

I call:

Uncaught TypeError: undefined is not a function when using jQuery UI

And included:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

      

Thus, all javascript became:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>  
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('#dpFrom').datepicker();

    });
</script>

      

However, it is giving me an error.

Please, help...

+3


source to share


3 answers


I think you have a duplicate jQuery link. Could you open View Source in your web browser and list the jQuery links? This is a common mistake and easily overlooked. Maybe the package definition or layout and content pages have the same link.



+13


source


The path must be https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js not //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery. min.js for both script links and css tags



+1


source


<script type="text/javascript">
    $( "#datepicker" ).datepicker();      
</script>

      


I tried this when I erase the function ().

0


source







All Articles