jQuery timepicker不想与日期选择器插件一起显示

jQuery timepicker does not want to display alongside a datepicker plugin

本文关键字:插件 一起 显示 选择器 日期 timepicker 不想 jQuery      更新时间:2023-09-26

我想在我的表单中使用来自网络的jQuery时间选择器,但由于某种原因它根本不起作用。

我在顶部还有一个用于jQuery日期选择器的文本框,并且有效,所以我不知道问题可能是什么。以下是我两者的链接:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge" />
    <title>Beauty Factory Bookings</title>
    <link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
    <!-- links for jquery datepicker -->
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/themes/redmond/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="jquery.ptTimeSelect.css" />
    <script type="text/javascript" src="jquery.ptTimeSelect.js"></script>
    <!-- links for jquery timepicker -->
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.12.1.min.js"></script>
    <script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

</head>

然后,这是我的javascript和html代码:

<div class="heading2">
    <p>Select Your Date:</p>
        <input type="text" id="datepicker" name="Date"/>
        <script>
            $(function() {
                $( "#datepicker" ).datepicker({dateFormat: 'dd/mm/yy'});
            });
        </script>
</div>
<div class="heading3">
    <p>Select Your Time:</p>
        <input name="time" value=""/>
        <script type="text/javascript">
            $(document).ready(function(){
                $('input[name="time"]').ptTimeSelect();
            });
        </script>
</div>

谁能看出这有什么问题,导致时间选择器根本不显示?

这是我从中获取时间选择器代码的网站:

http://pttimeselect.sourceforge.net/doc/documentation.html

尝试:

 <script type="text/javascript">
        $(document).ready(function(){
            $(function() {
                 $( "#datepicker" ).datepicker({dateFormat: 'dd/mm/yy'});
            });
            $('input[name="time"]').ptTimeSelect();
        });
    </script>