【发布时间】:2015-03-28 17:43:30
【问题描述】:
我有两个使用 jquery ui datepicker 的月份和年份选择器我想限制第二个月和年份选择器将仅在第一个日期选择器的月份和年份之后选择我不知道这是否可能请给我如果可能的话,指导我的脚本如下
<script>
$(document).ready(
function () {
$( "#date1_in_id" ).datepicker({
changeMonth: true,//this option for allowing user to select month
changeYear: true, //this option for allowing user to select from year range
dateFormat: "mm-yy",
showButtonPanel: true,
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
$( "#date2_in_id" ).datepicker({
changeMonth: true,//this option for allowing user to select month
changeYear: true, //this option for allowing user to select from year range
dateFormat: "mm-yy",
showButtonPanel: true,
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
});
</script>
<style>.ui-datepicker-calendar{display: none;}</style>
【问题讨论】:
标签: jquery datepicker