I want my datepicker is visible unless I call a close function. I couldnt find any function neither prevent close when I select a date, nor close it by myself manually. any ideas?
1 Answer
The solution is to show the datepicker inline. This means you attach it to a div instead of a textbox. It will always be displayed.
<div id="datepicker"></div>
$("#datepicker").datepicker();
To "close" it, simply hide the div:
$("#datepicker").hide();
See this demo for more detail: https://jqueryui.com/datepicker/#inline
Alternatively, if you leave your datepicker as it is now (not inline), you can use the "hide" method of datepicker plugin to close it manually. This was easy to find in the documentation at http://api.jqueryui.com/datepicker/#method-hide:
$("#datepicker").datepicker("hide");
Pass the string "show" instead to call the show method, which will display it again.
-
1oh thank you for the answer. Sorry for late reply. I was so stressed to do this so I gave a break. I tried the solution that in your answer and it worked. Commented Feb 9, 2017 at 1:29