我在项目中使用了时间选择器,但无法正常工作。这给了我未捕获的类型错误。
当我单击文本框时,我需要这样的输出
我尝试通过这种方式使用时间选择器:
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/clockpicker/0.0.7/bootstrap-clockpicker.min.css">
<title>TimePicker</title>
</head>
<body>
<div class="container">
<h2>Time Picker</h2>
<p>This example of time picker using bootstrap and jquery.</p>
<form>
<div class="form-group">
<label for="starttime">Start Time:</label>
<input type="text" class="form-control" id="starttime" readonly>
</div>
<div class="form-group">
<label for="endtime">End Time:</label>
<input type="text" class="form-control" id="endtitme" readonly>
</div>
</form>
</div>
<script>
$(".starttime").clockpicker({
twelvehour: true,
});
$("#endtitme").clockpicker({
twelvehour: true,
});
</script>
</body>
</html>
提前谢谢您
您应该添加Clockpicker库,但是您仅添加了样式表。在http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.js
行之前添加...bootstrap-clockpicker.min.css
此>
您在代码中缺少clock js
在document.ready中尝试。