I use the latest Bootstrap datepicker.js. All works fine except that when I pick a date from the drop down, it does not automatically close it. I searched web and tried to use the following function in my javascript like the following:
$('#selectDate').datepicker({ autoclose: true }).on('changeDate', function (ev) { (ev.viewMode == 'days') ? $(this).datepicker('hide') : ''; });
but when i use Google Chrome Dev tools, I realized that ev.viewmode was undefined. I am not sure how to move forward.
$(document). mouseup(function (e) { $('#example1'). Close(); });
Syntax: $(". selector"). datepicker("hide");
You have to use . show() method to keep your dateTimePicker visible, note that all the DateTimePicker's functions are reachable via the data attribute e.g.
I will suggest to add formate on datepicker as "YYYY" so it will only show years inside it.
I added autoclose: true, (with semi comma at the end and it works)
$('.datepicker').datepicker({ format: 'dd/mm/yyyy', todayHighlight:'TRUE', autoclose: true, })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With