How to blur the first form input at the dialog opening

datepicker, forms, jquery, jquery-ui

Solution

As mentioned, this is a known bug with jQuery UI and should be fixed relatively soon. Until then...

Here's another option, so you don't have to mess with tabindex:

Disable the datepicker temporarily until the dialog box opens:

dialog.find(".datepicker").datepicker("disable");
dialog.dialog({
    "open": function() {$(this).find(".datepicker").datepicker("enable");},
});

Works for me.

Problem

I have a jQuery.dialog who show a form. The first input is `<input type="text" class="datepicker" />` and I init the datepicker like this `jQuery('.datepicker').datepicker()`. The problem is when the dialog is opened, it focus the first input. So the datepicker is also opened. The dialog's event `open` is run before the focus is putting on. So, how can i blur the first focus to the datepicker stay hidden ?

Original source

Related problems