Skip to content

Datepicker show/hide function not working #2360

Open

Description

@x3wniu

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>

Activity

  1. mgol commented on Aug 6, 2025

    @mgol
    Member

    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.

  2. x3wniu commented on Aug 21, 2025

    @x3wniu
    Author

    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

  3. mgol commented on Aug 22, 2025

    @mgol
    Member

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions