我的时间选择器不起作用

时间:2014-01-20 06:24:07

标签: javascript jquery

朋友们,我的时间选择器不起作用,请有人帮助我

  <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script type="text/javascript" src="http://code.jquery.com/ui/1.10.1/jquery-ui.js">    </script>       
  <script type="text/javascript" src="../src/jquery-ui-timepicker-addon.js"></script>
  <script type="text/javascript">
   $(document).ready(function () {
       $('.time').each(function () {
           $('.time').timepicker({
               hourGrid: 4,
               minuteGrid: 10,
               timeFormat: 'hh:mm tt'
           });
       });
   });

1 个答案:

答案 0 :(得分:0)

您需要在html中添加timepicker

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

<!-- Add this script tag -->
<script type="text/javascript" src="[timepicker_LOCATION]/jquery-ui-timepicker-addon.js">
</script>

https://github.com/trentrichardson/jQuery-Timepicker-Addon

注意:此外,无需循环访问每个.time

删除循环

$('.time').each(function ()