[英]jquery time picker addon for date picker
我正在尝试通过Time Picker插件( http://trentrichardson.com/examples/timepicker/ )实现jQuery UI Date Picker。
我将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不断给我这些错误:
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();
有没有其他人遇到这个问题。 我确定我缺少一些简单的东西,但是我找不到任何遇到相同问题的人。
谢谢
在加载jQuery之前,先加载timepicker.js。 您的网页正在尝试运行timepicker.js,但对jQuery一无所知。 重新排列您的脚本,例如:
<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.