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 上工作

4

2 回答 2

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>

日期选择器 JS API

于 2015-06-29T07:07:05.723 回答
0

您可以阅读文档。有一段话叫做事件。例如,您只需添加一个小的 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> 
于 2015-06-29T07:50:22.233 回答