<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上
答案 0 :(得分: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>
{{3}}
答案 1 :(得分: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>