问题
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