我的问题是在页面加载时在文本框中自动填充这两个日期,然后根据日期使用 datepicker 过滤它们
我现在拥有的代码
<td >
<label for="from">Start date:</label>
<input type="text" id="from" />
<label for="to">End date:</label>
<input type="text" id="to" />
</td>
和脚本
$(function() {
$( "#from" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
任何帮助表示赞赏!