Change Datepicker minDate onClick
Hi there,
I am looking for a way to change the minDate of my datepicker onClick. I have two buttons, one needs to set the minDate to 0 and the other one to 1.
When the user then clicks the datepicker input field, the calender shows with the specific mindate.
So far I have below code, but the onClick does not change the minDate. What am I missing?
Thanks for the replies!
- $(function ()
- {
- $("#datepicker").datepicker({
- dateFormat: "M dd, yy"
- });
- });
- $('#testXX').click(function ()
- {
- $("#inputfield").val('15');
- $('#datepicker').datepicker('option', 'minDate', new Date()+$('#inputfield').val());
- });