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
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 to share