prevent datepicker close when clicking outside [closed]

久未见 提交于 2021-02-19 01:42:26

问题


I am using jquery datepicker .I want to prevent close functionality when clicking outside of calendar dialog box.

url:-http://jqueryui.com/datepicker/

Thanks


回答1:


In jquery.ui.datepicker.js this is the code for hiding calendar when clicking outside:

...
if (!$.datepicker.initialized) {
    $(document).mousedown($.datepicker._checkExternalClick);
    $.datepicker.initialized = true;
}
...

So you can remove this event handler by using:

$(document).unbind('mousedown', $.datepicker._checkExternalClick);



回答2:


If you create the datapicker on a div rather then an input box it will stay open all the time.
Is this what you want or should it be clicked upon to open and then stay open forever?




回答3:


assuming its the UI datepicker plugin

see here: http://forum.jquery.com/topic/jquery-datepicker-plugin-how-to-prevent-the-datepicker-calendar-popup-from-closing

and here: jQuery Datepicker: Prevent closing picker when clicking a date



来源:https://stackoverflow.com/questions/19241956/prevent-datepicker-close-when-clicking-outside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!