带有时间选择器的问题

问题描述 投票:0回答:2

我在项目中使用了时间选择器,但无法正常工作。这给了我未捕获的类型错误。

当我单击文本框时,我需要这样的输出

我尝试通过这种方式使用时间选择器:

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

提前谢谢您

jquery html css timepicker
2个回答
0
投票

您应该添加Clockpicker库,但是您仅添加了样式表。在http://weareoutman.github.io/clockpicker/dist/jquery-clockpicker.min.js行之前添加...bootstrap-clockpicker.min.css此>


0
投票

您在代码中缺少clock js


0
投票

在document.ready中尝试。

© www.soinside.com 2019 - 2024. All rights reserved.