我尝试使用 Following timepicker 。但是,我无法运行它。我正如作者所建议的那样使用jsDelivr CDN。
我按照正确的顺序包含作者列出的所有文件:
datetimepicker CSS
<!doctype html>
<meta charset="utf-8">
<title>Example</title>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-sliderAccess.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-timepicker-addon.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-timepicker-addon.css">
<script>
$function () {
$('#input').datetimepicker();
});
</script>
<title>Example</title>
</head>
<body>
<input type="text" id="input" name="input" value=""/>
</body>
</html>
单击表单时不显示任何内容。
答案 0 :(得分:1)
$function () {
$('#input').datetimepicker();
});
应该是
$(function () {
$('#input').datetimepicker();
});
答案 1 :(得分:1)
<强> Working fiddle 强>
问题在于以下示例将起作用:
<!doctype html>
<meta charset="utf-8">
<title>Example</title>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/jquery-ui-timepicker-addon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/jquery-ui-timepicker-addon.min.js"></script>
</head>
<body>
<input type="text" id="input" name="input" value=""/>
<script>
$(function () {
$('#input').datetimepicker();
});
</script>
</body>
</html>
希望这有帮助。