JQuery Mobile DatePicker无法在弹出窗口上正常工作



我正在开发简单的演示应用程序,以使用jQuery Mobile DatePicker和jQuery Mobile Popup从用户开始日期和结束日期。我的问题是,弹出窗口正在成功打开,但是当我尝试单击"开始日期"文本框datepicker calender成功打开时,但是接下来,如果我单击"结束日期"不起作用...是什么是根本原因,我'我没有得到...请帮助我。

这是代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DatePicker Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="../public/js/jquery.js"></script>
<script type="text/javascript" src="../public/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../public/js/jquery.mobile-1.4.0.min.js"></script>
<script type="text/javascript" src="../public/js/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="../public/js/jquery.mobile-git.js"></script>
<script type="text/javascript" src="../public/js/jquery.mobile.datepicker.js"></script>
<link rel="stylesheet" href="../public/stylesheets/jquery.mobile-1.4.0.min.css">
<link rel="stylesheet" href="../public/stylesheets/jquery.mobile-git.css">
<link rel="stylesheet" href="../public/stylesheets/jquery.mobile.datepicker.css">
</head>
<body>
  <a href="#popupDemo" data-rel="popup" data-position-to="window" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-check ui-btn-icon-left ui-btn-a" data-transition="pop">Open Popup</a>
  <div data-role="popup" id="popupDemo" data-theme="a" class="ui-corner-all">
     <div data-role="content">
        <form>
           <div style="padding:10px 20px;">
              <h3>Date Picker</h3>
                 <input type="text" id="startdate" data-inline="false" data-role="date" placeholder="Start Date">   
                 <input type="text" id="enddate" data-inline="false" data-role="date" placeholder="End Date">
                 <button type="submit" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">Save</button>
           </div>
         </form>
       </div>
     </div>
   </body>
</html>

您尝试过

是否尝试过
$('#startdate, #enddate').on("click", function(this){
    $(this).datepicker("destroy");
    $(this).datepicker({
        changeMonth: true, 
        changeYear: true,
        minDate: new Date('2013','01', '01'), 
        maxDate: new Date(),
        //...and other setup lines you need
    });
$(this).datepicker("refresh");
});

嗨,这是日期选择器的工作代码,我们必须添加此JS jquery.ui.datepicker.js

<!DOCTYPE html>
    <html>
       <head>
          <meta name = "viewport" content = "width = device-width, initial-scale = 1">
          <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
          <link rel = "stylesheet" href = "https://rawgithub.com/arschmitz/jquery-mobile-datepicker-wrapper/master/jquery.mobile.datepicker.css" />
          <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
          <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
          <script src = "https://rawgithub.com/jquery/jquery-ui/1-10-stable/ui/jquery.ui.datepicker.js"></script>
          <script src = "https://rawgithub.com/arschmitz/jquery-mobile-datepicker-wrapper/master/jquery.mobile.datepicker.js"></script>
       </head>
       <body>
          <h2>Vipul Datapicker Example</h2>
          <form>
             <input type = "text" data-role = "date">
          </form>
       </body>
    </html>

jsfiddle演示: -

https://jsfiddle.net/vipulg/g41eocs2/

最新更新