这是我需要修复要求的片段
在这里,我使用 jquery 作为 datepicker
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes
/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
在这里,我让 datepicker 通过下拉列表选择月份,但问题是在两个字段中,用户可以选择月份,但我需要限制“to”字段中的月份选择,因为第二个 datepicker 应该显示“from field”本身的月份
$(document).ready(function () {
$("#datepicker,#datepicker1").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-0:c+10",
dateFormat: "dd - M - yy"
});
$('#datepicker,#datepicker1').datepicker("setDate", new Date());
});
这是两个日期选择器,有两个字段名“from”和“to”
<li><label class="label">From:</label></li>
<li><input name="fdate" type="text" class="sel" size="10"
id="datepicker" required /><li>
<li><label class="label1">To:</label></li>
<li><input name="tdate" type="text" class="sel" size="10"
id="datepicker1" required /><li>
<li ><label class="label" >Weeks:</label></li>