jQuery UI Datepicker范围
几天前,我问了一个非常相似的问题,但这是足够不同,以至于我不想让其他有用的话题脱轨.我基本上想设置两个文本输入字段,并将它们与jQuery UI的Datepicker挂钩,以使它们充当范围...我希望第二个输入字段的开始日期取决于您在第一个输入中选择的内容场地.例如,如果我为第一个字段选择10-25-2010,那么您可以在第二个字段中选择的最早日期应该是10-26-2010.在这个主题上的任何帮助或指示,将不胜感激!
I asked a pretty similar question a few days ago, but this one is different enough that I didn't feel like derailing the other helpful topic. I basically want to set up two text input fields and hook them both up with jQuery UI's Datepicker to have them act as a range... I want the second input field start date to be contingent upon what you've selected in the first input field. For instance if I select 10-25-2010 for the first field, then the earliest day you can select in the second field should be 10-26-2010. Any help or direction on this topic would be greatly appreciated!
$(function() {
$('#txtStartDate, #txtEndDate').datepicker({
showOn: "both",
beforeShow: customRange,
dateFormat: "dd M yy",
});
});
function customRange(input) {
if (input.id == 'txtEndDate') {
var minDate = new Date($('#txtStartDate').val());
minDate.setDate(minDate.getDate() + 1)
return {
minDate: minDate
};
}
}