I have a field with a datepicker. I want know if it is open. I've tried with:
$("#filter_date").datepicker( "widget" ).is(":visible")
but it returns always true.
How can I check if it's open?
You can check to see if the datepicker script has loaded using: if ($. fn. datepicker) { // ... }
datepicker(). on("show", function () { isCalendarVisible = true; }). on("hide", function () { isCalendarVisible = false; });
You need to include jQuery, and include it before jQuery UI. You also need to move your code to the end of your document or wrap it in a document ready call. Include a reference to jQuery before jQuery UI. Thanks for the response .
The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.
This might be a possible bug in the past. Now this solution
$("#filter_date").datepicker( "widget" ).is(":visible")
works perfectly
Simply set:
#ui-datepicker-div { display: none; }
in your CSS file and your code:
$("#filter_date").datepicker( "widget" ).is(":visible")
will work correctly!
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