Skip to content
Advertisement

bootstrap datepicker today as default

I am using this bootstrap-datepicker for my datepicker. I’d like the datepicker to choose “today” for start day or default day. I cannot figure out how to set “today” automatically, so I did an inefficient way

HTML:

JavaScript

JS:

JavaScript

Online Sample: http://jsfiddle.net/BXZk2/

Just looking for an easy solution to make the default day as “TODAY”.

Thanks

Advertisement

Answer

This should work:

$("#datepicker").datepicker("setDate", new Date());

And for autoclose (fiddle):

JavaScript

jQuery > datepicker API

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement