2015-06-29 57 views
0
<script type="text/javascript"> 
$('.datepicker').pickadate(); 
$('.datepicker2').pickadate(); 
</script> 

<form action="#" method="get"> 
    Check In Date: <input type="text" class="datepicker"><br> 
    Check Out Date: <input type="text" class="datepicker2"><br> 
    <input type="submit" value="Submit"> 
</form> 

這僅僅是HTML,我提出的基本形式,我對如何使自動填寫工作不知道在pickadate.js如何使「退房日期」自動填充的「日期檢查」次日使用pickadate.js

回答

0
$(function(){ 
    $("#submit").click(function(event) 
    { 
     event.preventDefault(); 

     $('#datepicker').pickadate(); 
     $('#datepicker2').pickadate(); 

    } 
}); 

    <form action="#" method="post"> 
     Check In Date: <input type="text" id="datepicker" class="datepicker"><br> 
     Check Out Date: <input type="text" id="datepicker2" class="datepicker2"><br> 
     <input type="submit" value="Submit" id="submit"> 
    </form> 

Date Picker JS API

0

您可以閱讀docs。有一段話叫做事件。例如,您可以添加一個小的onSet函數,該函數將日期設置爲第二個日期選擇器。

<script type="text/javascript"> 
$('.datepicker').pickadate(
    onSet: function(context) { 
     // Maybe set the min date for the second datepicker. 
     $('.datepicker2').pickadate(
      min: new Date(document.getElementByClassName("datepicker").value), 
     ); 
     // maybe increment the value by one too... 
    } 
); 

$('.datepicker2').pickadate(); 
</script> 

<form action="#" method="get"> 
    Check In Date: <input type="text" class="datepicker"><br> 
    Check Out Date: <input type="text" class="datepicker2"><br> 
    <input type="submit" value="Submit"> 
</form> 
相關問題