change the enddate choice with jquery datepicker
I have 2 textboxes: StartDate and endDate How can I make so the user will开发者_开发百科 be able to pick from the endDate only the dates starting from the startDate text box and ending 24 hours after the startDate?
I tried this but it didnt work:
$("#startDate").change(function() {
test = $(this).datepicker('getDate');
$("#endDate").datepicker("option", "minDate", test);
});
Thanks in advance!
Greg
You can set the minDate
to 1 day later than the chosen #startDate
like this:
$("#startDate").change(function() {
var test = $(this).datepicker('getDate');
test.setDate(test.getDate() + 1);
$("#endDate").datepicker("option", "minDate", test);
});
You can test it out here.
精彩评论