TimePicker改变自己的时间

时间:2017-09-18 07:45:15

标签: javascript jquery datetime datetimepicker timepicker

这是kendo TimePicker的代码,我有问题,当你点击侧面日期时,它会改变自己的时间。我不知道它是如何发生的或不知道如何解决它。

文件网址:: http://demos.telerik.com/kendo-ui/timepicker/index

DEMO jsfiddle

<!DOCTYPE html>
<html>
<head>
    <base href="http://demos.telerik.com/kendo-ui/timepicker/index">
    <style>
        html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }
        .hidden { display: none!important}
    </style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.common-material.min.css" />
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.material.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2017.3.913/styles/kendo.material.mobile.min.css" />
    <script src="https://kendo.cdn.telerik.com/2017.3.913/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2017.3.913/js/kendo.all.min.js"></script>
</head>
<body>
    <div id="example">
        <div class="demo-section k-content">
            <h4>Set alarm time</h4>
            <input id="settimepicker" value="" title="timepicker" />
        </div>
        <script>
            $(document).ready(function () {
                // create TimePicker from input HTML element
                $("#settimepicker").kendoTimePicker({
                    dateInput: true,
                    dates: [
                        new Date(2000, 9, 9, 9, 0, 0),
                        new Date(2000, 9, 9, 9, 30, 0),
                        new Date(2000, 10, 10, 10, 0, 0),
                        new Date(2000, 10, 10, 10, 30, 0),
                        new Date(2000, 11, 11, 11, 0, 0),
                        new Date(2000, 11, 11, 11, 30, 0)
                    ] 
                });
            });
            setTimeout(function(){ $("#settimepicker").val(""); }, 500);

        </script>
    </div>
</body>
</html>

我们将不胜感激任何帮助或建议

1 个答案:

答案 0 :(得分:0)

 setTimeout(function(){ $("#settimepicker").val(""); }, 500);

将此功能置于 $(document).ready(function () {});

然后就可以了。