简体   繁体   English

时间选择器的jQuery时间选择器插件

[英]jquery time picker addon for date picker

I'm trying to implement the jQuery UI Date Picker with the Time Picker addon ( http://trentrichardson.com/examples/timepicker/ ). 我正在尝试通过Time Picker插件( http://trentrichardson.com/examples/timepicker/ )实现jQuery UI Date Picker。

I have the js and css saved in the same directory as my script as timpicker.js and picker.css respectively. 我将js和css分别与timpicker.js和picker.css保存在与脚本相同的目录中。

<!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.com/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.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/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: Firebug不断给我这些错误:

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 come 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 谢谢

You are loading the timepicker.js before you load jQuery. 在加载jQuery之前,先加载timepicker.js。 Your page is trying to run timepicker.js and doesn't know anything about jQuery. 您的网页正在尝试运行timepicker.js,但对jQuery一无所知。 Rearrange your scripts like: 重新排列您的脚本,例如:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<script src="timepicker.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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