1

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?

Colin DeClue
  • 2,194
  • 3
  • 26
  • 47

1 Answers1

4

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

Community
  • 1
  • 1
bygrace
  • 5,868
  • 1
  • 31
  • 58