簡體   English   中英

用戶無法選擇上一個日期jQuery-ui Datepicker

[英]User cant Select Previous Date jQuery-ui Datepicker

嗨,朋友,如何限制用戶不要選擇以前的日期,然后再以相同的形式選擇用戶之前選擇的日期,以下是我的代碼

HTML

<table>
<tr>
          <td align="right">Check in date</td>
          <td width="81%" style="padding:0;"><table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="25%"><input type="text" name="ww" size="30" id="checkIn" class="nameBook"/></td>
              <td width="15%" align="right">Check out date*</td>
              <td width="60%"><input type="text" name="ww2" size="30" id="checkOut" class="nameBook"/></td>

            </tr>
          </table></td>
        </tr>
</table>

腳本

<script>
$(document).ready(function() {
    $( "#checkIn" ).datepicker({ minDate: 0,  dateFormat: "yy-mm-dd"}); 
        var checkIn = $( "#checkIn" ).val();
        $( "#checkIn" ).on('change',function(){
             alert(checkInDate);                
        })
    $( "#checkOut" ).datepicker({ minDate: /*Not Lasser then the date which user selects in #checkIn*/ });
});
</script>

請幫我...

選擇后,您可以改變思維方式

onSelect: function( selectedDate ) {
    $( "#to" ).datepicker( "option", "minDate", selectedDate );
  }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM