Posts Tagged with jquery blur

Displaying 1-1 of 1 result.
Resolved: Remove focus from an input field in a jquery dialog
posted by admin on August 24, 2016
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.

Edit:

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".

$("#select_date").click(function(){
$("#select_date_dialog").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) {
$('#custom_from_date').blur();
}

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