javascript - Current date selected by default in twitter bootstrap datepicker -
i trying have current date selected default in twitter bootstrap datepicker. after googling while found way this. have this:
$('#date').datepicker('setdate', new date()); $('#date').datepicker('update') $('#date').datepicker({ autoclose: true, startdate: '-2m', enddate: '+1d' });
this works nicely, code ugly (why need touch datepicker 3 times). looking documentation have not found way in 1 function.
after last attempt:
$('#date').datepicker({ autoclose: true, startdate: '-2m', enddate: '+1d', setdate: new date() });
i gave up. there way write same thing in 1 function?
what understand post, first 2 invocations call setdate , update functions. not properties, cannot set them tried.
the third invocation though sets various attributes in object literal notation.
Comments
Post a Comment