Here are two ways to solve the problem of automatic focus when jquery Dialog open. The concrete realization method Everybody may refer to this article.
Method One:
P1_dialog_seniorsearch.dialog ({
title: "Advanced Query",
autoopen:false,//default close
modal:true,//Open mask layer
width : 570,
height:330,
buttons: {
query: function () {
seniorsearch (1,20)
},
close: function () {
p1_dialog_seniorsearch.dialog (' close ');
}
,
open:function (event, UI) {
$ (this). Parent (). focus ();
Cancel get Focus
});
Method Two:
Add autofocus to the control that you want to focus on
Such as: The first control is DatePicker, the default dialog open automatically pop-up calendar
Solution: Add a hidden input in the dialog,
<input type= "hidden" autofocus/>
No added Autofocus,dialog will not focus on the shadow of the input.
Ps:jquery dialog automatically focus on the first control when it is opened
In the project, the use of JQuery dialog, in dialog ("open") a page, the focus will automatically focus on the first control, just this control binding datepicker, the calendar automatically bounced out, tangled half-day fruitless, Google a bit, The same problem has been encountered. Give the solution first
<input Autofocus> adds a autofocus attribute to the label to give the specified control the focus. For example, the first is a date control, then add this attribute to other tags, the first calendar control will not focus, and will not bounce out. In other words, this method is a bit like a decoy.
A URL to address the problem is attached:
Http://stackoverflow.com/questions/1202079/prevent-jquery-ui-dialog-from-setting-focus-to-first-textbox
http://jqueryui.com/upgrade-guide/1.10/
The above is a small set to introduce the jquery Dialog open when the automatic focus of the solution, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!