Directly set UIDatePickers min, max date properties using jQuery
I have the following jQuery code to initialise a datepicker:
$( "#datepickertwo" ).datepick开发者_运维知识库er(
{
dateFormat: 'dd-mm-yy',
buttonImage: 'images/calendar.gif',
showOn: "both",
buttonImageOnly: true,
maxDate: new Date(parseInt(<?php echo($maxDate[0]);?>),parseInt(<?php echo($maxDate[1]);?>),parseInt(<?php echo($maxDate[2]); ?>)),
minDate: new Date(parseInt(<?php echo($minDate[0]);?>),parseInt(<?php echo($minDate[1]);?>),parseInt(<?php echo($minDate[2]); ?>)),
}
);
During user interaction, the datepicker's min and max dates will need to change.
My question is, how can I directly change the min max properties of the UIDatePicker after it has already been created?
I think you should do:
var newMaxDate = //set your new date here
$( "#datepickertwo" ).datepicker( "option" , 'maxDate', newMaxDate);
精彩评论