I am trying to implement the Jquery datetime picker on web page but keep getting the following error:
Uncaught TypeError: Cannot read property 'timepicker' of undefined
I downloaded the timepicker add on from here:
http://trentrichardson.com/examples/timepicker/#basic_examples
http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js
Here is the section of the code generating the error:
$.ui.timepicker = $.ui.timepicker || {};
if ($.ui.timepicker.version) {
return;
}
On my web page I have the following:
<script type="text/javascript" src="/Scripts/jquery-lib/jquery-2.0.3.js"></script>
<script type="text/javascript" src="/Content/bootstrap/js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/Content/bootstrap/js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="/Content/bootstrap/js/jquery-ui-sliderAccess.js"></script>
And script:
<script>
$(function () {
$("#datetimepicker").datepicker();
});
Uncaught TypeError: Cannot read property 'timepicker' of undefined means that
$.ui
is undefined. So, you probably have not included jQuery UI. Try to include it before any of your scripts (except jQuery itself).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With