Reputation: 4523
I want to close datepicker when click on day. How is this possible in Bootstrap Datepicker?
Here is the fiddle:
$('#dob').datepicker(
{
endDate:ageDate
}
);
Upvotes: 11
Views: 22282
Reputation: 764
$('#Date3').datepicker({
format: "mm-yyyy",
viewMode: "months",
minViewMode: "months"
}).on('changeDate', function (e) {
$('#Date3').datepicker('hide');
});
Upvotes: 0
Reputation: 18610
Note that if you are using Stefan Petre's original version of the Bootstrap Datepicker, the autoclose property will [as of this writing] not work. In this case, you should do something like this:
$('#myDate').datepicker().on('changeDate', function (e) {
$('#myDate').datepicker('hide');
});
If you're using eternicode's forked version, the autoclose property will work.
Upvotes: 6
Reputation: 1345
initialize your date picker with option 'autoclose'
$('#dob').datepicker(
{"autoclose": true});
or you can close date picker by using following code also
$('#dob').datepicker().on('changeDate', function (ev) {
$('#dob').hide();
});
Upvotes: 4
Reputation: 2786
You the auto-close property of the bootstrap date-piker like below
$('#dob').datepicker(
{
endDate:ageDate,
autoclose: true
}
);
I have already updated your js-fiddle
Upvotes: 34