Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if datepicker is open

Tags:

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?

like image 372
Luca Romagnoli Avatar asked May 06 '10 09:05

Luca Romagnoli


People also ask

How do I know if my datepicker is loaded?

You can check to see if the datepicker script has loaded using: if ($. fn. datepicker) { // ... }

How check datepicker is open or not in jQuery?

datepicker(). on("show", function () { isCalendarVisible = true; }). on("hide", function () { isCalendarVisible = false; });

Why datepicker is not working in HTML?

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 .

How do I use datepicker?

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.


2 Answers

This might be a possible bug in the past. Now this solution

$("#filter_date").datepicker( "widget" ).is(":visible") 

works perfectly

like image 132
dr3w Avatar answered Sep 27 '22 21:09

dr3w


Simply set:

#ui-datepicker-div { display: none; } 

in your CSS file and your code:

$("#filter_date").datepicker( "widget" ).is(":visible") 

will work correctly!

like image 22
jQuery Italia Avatar answered Sep 27 '22 20:09

jQuery Italia