Forcing jquery ui datepicker to close / missing popup

I have a jquery ui datepicker in a dialog box and I noticed when I close the dialog box that it sometimes adheres to.

I tried to do

$('#ui-datepicker-div').hide(); 

but that doesn't seem to hide it all.

I see that there is a dialogue option, but I have no clue if this is what I need and how to use it.

Dialog window

 .datepicker( "dialog" , date , [onSelect] , [settings] , [pos] ) 

Open the datepicker parameter in the dialog box.

dateText: start date for selecting a date as Date or string in the current date format.

onSelect: callback function when the date is selected. The function receives the text of the date and the date of the instance as parameters.

: New settings for date selection.

pos: The position of the top / left dialog as [x, y] or MouseEvent which contains the coordinates. If it is not indicated that the dialogue is centered on the screen.

Also sometimes, when I open a dialog, the date picker opens and is located in the left corner of the screen under the dialog.

I believe that this is because I fill in the default value, but I do it through the datepicker, so I'm not sure why it appears sometimes, and sometimes not

  $('#datepicker').datepicker("setDate", '+1d') 
+4
source share
2 answers

It is better to use .remove() instead of .hide() in scripts where you create new instances.

Or better: use the datepicker method, for example .datepicker("hide") .. you can see it in the documentation .

+6
source

You can also implement this with css. This is not the best way to do this, but it certainly does the job for you.

 $('#datepicker').css('visibility','hidden'); 
0
source

All Articles