tau
tau

Reputation: 6749

jQuery UI datepicker onSelect bubbling

I'm using the "onSelect" setting of the jQuery UI datepicker. Unfortunately I have two calendars where the user needs to select the date on each one AND I also need the calendars to hide if the user clicks on the page. So, I attached a click event to the HTML tag that hides the calendar. The problem is that when I use the "onSelect" method of the datepicker, that also triggers the click event on the HTML tag and hides the calendar!

Any ideas?

Upvotes: 0

Views: 386

Answers (1)

Daniel Brockman
Daniel Brockman

Reputation: 19290

if ($(event.target).closest(".ui-datepicker").size() === 0) {
    // No date picker was clicked!
}

Upvotes: 1

Related Questions