I want to close the datepicker when I click on the day. How is this possible in Bootstrap Datepicker?
Here is the fiddle:
http://jsfiddle.net/kGGCZ/17/
$('#dob').datepicker( { endDate:ageDate } );
You can use the auto-close property for the date-piker bootstrap, as shown below
$('#dob').datepicker( { endDate:ageDate, autoclose: true } );
I have already updated the js fiddle
Updated fiddle
Note that if you are using the original Bootstrap Datepicker version of Stefan Petre, the autoclose property [at the time of this writing] will not work. In this case, you should do something like this:
$('#myDate').datepicker().on('changeDate', function (e) { $('#myDate').datepicker('hide'); });
If you use a perpetual code branched version , the autoclose property will work.
initialize your date picker with the "autoclose" option
$('#dob').datepicker( {"autoclose": true});
or you can close the date picker using the following code.
$('#dob').datepicker().on('changeDate', function (ev) { $('#dob').hide(); });
$('#Date3').datepicker({ format: "mm-yyyy", viewMode: "months", minViewMode: "months" }).on('changeDate', function (e) { $('#Date3').datepicker('hide'); });