I have a button onclick of which a jquery dialog appears with two input fields which are jquery datepickers. Whenever the dialog appears, the first fields gets focus automatically, hence the datepicker pops up. I have resolved this for now by adding another dummy input field. Is there a better way ?

Sorry if the question is repeated. I tried searching for one already existing but couldn't get one. Please point me to an existing question if present.


Okay my code goes as follows. onClick of a button the jdialog appears and there are 2 datepicker input fields inside the div "select_date_dialog".

modal: true,
dialogClass: 'connect-dialog',
height: 100,
width: 500

afaik: can you be a bit more specific how blur will help me ? I tried adding this as suggested.

open: function(event, ui) {

blur happens when there input field loses focus. can i use blur to specify whether that field should get focus or not ?