最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery time picker addon for date picker - Stack Overflow

programmeradmin2浏览0评论

I'm trying to implement the jQuery UI Date Picker with the Time Picker addon (/).

I have the js and css saved in the same directory as my script as timpicker.js and picker.css respectively.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Select a Date Range</title>
<link rel="stylesheet" href=".10.1/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="picker.css" />
<script src="timepicker.js"></script>
<script src=".9.1.js"></script>
<script src=".10.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$('#from').datetimepicker();
</script>
</head>
<body>
<label for="from">From</label>
<input type="text" id="from" name="from" />
</body>
</html>

Firebug keeps giving me these errors:

ReferenceError: jQuery is not defined
[Break On This Error]   

})(jQuery);

datetimepicker.js (line 1919)

TypeError: $(...).datetimepicker is not a function
[Break On This Error]   

$('#from').datetimepicker();

Has anyone else e across this problem. I'm sure I'm missing something simple, but I have been unable to find anyone with the same problem.

Thank you

I'm trying to implement the jQuery UI Date Picker with the Time Picker addon (http://trentrichardson./examples/timepicker/).

I have the js and css saved in the same directory as my script as timpicker.js and picker.css respectively.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Select a Date Range</title>
<link rel="stylesheet" href="http://code.jquery./ui/1.10.1/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="picker.css" />
<script src="timepicker.js"></script>
<script src="http://code.jquery./jquery-1.9.1.js"></script>
<script src="http://code.jquery./ui/1.10.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$('#from').datetimepicker();
</script>
</head>
<body>
<label for="from">From</label>
<input type="text" id="from" name="from" />
</body>
</html>

Firebug keeps giving me these errors:

ReferenceError: jQuery is not defined
[Break On This Error]   

})(jQuery);

datetimepicker.js (line 1919)

TypeError: $(...).datetimepicker is not a function
[Break On This Error]   

$('#from').datetimepicker();

Has anyone else e across this problem. I'm sure I'm missing something simple, but I have been unable to find anyone with the same problem.

Thank you

Share Improve this question asked Mar 12, 2013 at 21:35 MildfireMildfire 3231 gold badge5 silver badges16 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You are loading the timepicker.js before you load jQuery. Your page is trying to run timepicker.js and doesn't know anything about jQuery. Rearrange your scripts like:

<script src="http://code.jquery./jquery-1.9.1.js"></script>
<script src="http://code.jquery./ui/1.10.1/jquery-ui.js"></script>
<script src="timepicker.js"></script>
发布评论

评论列表(0)

  1. 暂无评论