Reputation: 2244
I'm trying to have a time picker (this one) to not auto-open when it's inside a modal dialog.
Here's a js fiddle demonstrating the problem. If I have a text box outside of the modal, and call .timepicker on it, it doesn't open right up. If I open up the modal dialog that contains another timepicker, it's already open. Anyone know of a way I can work around this?
Upvotes: 1
Views: 1384
Reputation: 5988
Add tabindex="-1" to the input field in the modal. After some digging I learned that jQuery dialogue will select the first input field. When the input field gains focus it activates the timepicker. Here are some interesting reads on the topic:
Prevent jQuery UI dialog from setting focus to first textbox
http://bugs.jqueryui.com/ticket/4731
Upvotes: 4