Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery datepicker to prevent past date

How do I disable past dates on jQuery datepicker? I looked for options but don't seem to find anything that indicates the ability to disable past dates.

UPDATE: Thanks yall for the quick response. I tried that with no luck. Days were still not grayed out as I expected and still accept the selected past date.

I tried this:

$('#datepicker').datepicker({ minDate: '0' }); 

Doesn't work.

I tried this:

$('#datepicker').datepicker({ minDate: new Date() }); 

Still doesn't work either.

It displays the calendar widget just fine. It just won't gray out or prevent input of past days. I've attempted the minDate and maxDate in the past with no luck so I figured it must not be them.

like image 845
netrox Avatar asked Nov 23 '09 22:11

netrox


1 Answers

Try this:

$("#datepicker").datepicker({ minDate: 0 }); 

Remove the quotes from 0.

like image 177
Khawar Avatar answered Sep 16 '22 18:09

Khawar