jquery-ui icon indicating copy to clipboard operation
jquery-ui copied to clipboard

Datepicker show/hide function not working

Open x3wniu opened this issue 5 months ago • 3 comments

When create a datepicker for a div (non-input) elementm the show/hide functions don't work.

<div id="datepicker"></div>

<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js"></script>
<script>
$("#datepicker").datepicker();
$("#datepicker").datepicker("hide");
</script>

x3wniu avatar Jul 13 '25 12:07 x3wniu

Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?

Also, please provide a runnable test case on a platform like JS Bin.

mgol avatar Aug 06 '25 17:08 mgol

Actually my project uses a very old version jQuery UI 1.8.5. I guess this issue exists all the time.

https://jsbin.com/dodahanaxa/edit?html,console,output

x3wniu avatar Aug 21 '25 15:08 x3wniu

Thanks for the report. The datepicker module only supports hiding a datepicker that's displayed in an overlay; it depends on only one such instance being present. Therefore, it's incompatible with inline datepickers that may exist in a number of places. I think we should just update the docs at https://github.com/jquery/api.jqueryui.com/blob/62e5ad632267abd0d0ebdc4e9f5b550064fcd05f/entries/datepicker.xml. PRs for that welcome!

mgol avatar Aug 22 '25 09:08 mgol