JQuery UI DatePicker - How to Manually Open a Date Picker

How can I manually open datepicker for js code?

+5
source share
4 answers

To show the datepicker associated with the login with id 'your_elem', you should use something like this:

jQuery('#your_elem').datepicker("show");
+17
source

$('#datepickerid').focus() gotta do the trick.

0
source
$(function () {
    $('#DatePicker').datepicker({
        duration: '',
        showTime: true,
        constrainInput: false,
        maxDate: '+1y',
        minDate: '-0d',
        defaultDate: ''
    });
});
0
source

I had this problem (datepicker in this case was part of the Drupal module) and it worked for me:

$('input.date').focus();
$('input.date').click();

This did not work when used only $('input.date').click();.

0
source

All Articles