I'm using Bootstrap datepicker and I'd like to make that when datepicker shows, default date would be set after 14 days from today. I've got this code but it doesn't work, default date is still set to today. Could anyone explain what am I missing? Thanks in advance.
JS:
var plus14days = new Date();
plus14days.setDate(plus14days.getDate() + 14 );
$(".datepicker").datepicker("setValue", plus14days);
Go to line 1399 and find format: 'mm/dd/yyyy' . Now you can change the date format here.
Syntax: $(". selector"). datepicker( {defaultDate:"+6"} );
By default, the DatePicker value is null and the Calendar popup is hidden.
The code you've used is right.
The date will be displayed in textbox
, but not in datepicker calendar like this
To enable this feature you need to update it using the following code:
$(".datepicker").datepicker('update');
Now it looks like
Check this in JSFiddle
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