Onclick day close bootstrap datepicker

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 } ); 
+6
source share
4 answers

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

+24
source

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.

+5
source

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(); }); 
+4
source
 $('#Date3').datepicker({ format: "mm-yyyy", viewMode: "months", minViewMode: "months" }).on('changeDate', function (e) { $('#Date3').datepicker('hide'); }); 
0
source

All Articles