Search code examples
javascriptjqueryjquery-uijquery-ui-datepickerjquery-events

How to disable closing of datepicker on jQuery UI Datepicker


When I open a datepicker like that:

$("#checkindate,#checkoutdate").datepicker({
    onClose: {
       //I'd like to disable the closing
    }
);

I'd like to prevent the closing of the datepicker dialog depending on a condition. The ideal would be that return false would stop this event.

I tried modifying the source code and there is no trivial solution.

What I want to do is to be able to select the checkout date without reopening another dialog.

Any idea?


Solution

  • I don't think it's possible to pick multiple dates from one datepicker. You probably will need to do something like their date range demo: http://jqueryui.com/demos/datepicker/#date-range