Bootstrap datepicker hide after selection
If it's any help to anyone, the Version 2.0 of the bootstrap datepicker no longer works with the accepted answer.
Here's how I got it working on mine:
$('yourpickerid').datepicker({
format: 'dd/mm/yyyy',
}).on('changeDate', function(e){
$(this).datepicker('hide');
});
See http://bootstrap-datepicker.readthedocs.org/en/latest/events.html#changedate
You can use event changedate()
to keep track of when the date is changed together with datepicker('hide')
method to hide the datepicker
after making selection:
$('yourpickerid').on('changeDate', function(ev){
$(this).datepicker('hide');
});
Demo
UPDATE
This was the bug with autoclose: true
. This bug was fixed in latest master. SEE THE COMMIT. Get the latest code from GitHub
$('#input').datepicker({autoclose:true});