I'm having a textbox, when user click on it calender appears.This works fine,the calender showing the current date and previous date all are disable.But now i want to show calender with yesterday date selected.How can i achieve this.
for eg: if current date is 19-July-2012 then the calender must show date from 18-july-2012 and all other date before 18th must be inactive.how can I do that ?
Thanks in advance.
Visit the documentation: http://docs.jquery.com/UI/Datepicker#option-defaultDate
$( ".yourselector" ).datepicker({ defaultDate: -1, minDate:'-1d' });
To have yesterday selected, you can do:
$( ".selector" ).datepicker({ defaultDate: -1 });
See http://jqueryui.com/demos/datepicker/#option-defaultDate for the details.
Edit:
Based on the comment, the DatePicker should show dates from yesterday. So this requires a minDate of yesterday.
$(".selector").datepicker({minDate: -1});
See: http://jsfiddle.net/E3VEm/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With