iamcocoy
iamcocoy

Reputation: 31

jqueryui datepicker appears every time dialog is envoked

any help is much appreciated. Everytime: $("#myid").dialog() is opened, my datepicker also pops out, I didnt even click the input field of it. Why is so? tnx in advance.

Upvotes: 3

Views: 485

Answers (2)

Ryan Ternier
Ryan Ternier

Reputation: 8804

What type of control is myid? If it is a textbox you will most likely be getting the date picker because the dialog box does invoke that control.

If your myid field is in the dialog box, ensure that it's not the first field entered.

You also might want to attach the date picker when the dialog is finished opening.

But as Teja recommended, some markup + scripts would be nice.

Upvotes: 0

jmar777
jmar777

Reputation: 39649

Is the element with the datepicker the first "tab-able" item within the modal? If so, it is being auto-focused, and unfortunately there are no options to not auto-focus on open.

The only solutions I can think of are to...

  1. Put some other element before the datepicker that can receive focus, or
  2. Don't atach the datepicker behavior on dom load, and rather do it inside of the dialog's "open" callback

Upvotes: 5

Related Questions