Jquery UI模式对话框,将焦点设置在第一个表单元素上 [英] Jquery UI modal dialog, set focus on first form element
问题描述
我目前正在使用jquery UI模式框。
我想知道如何在打开对话框时将焦点设置到模态框的第一个表单元素上我认为这是默认发生的,但由于某些原因它不是。
如何在打开时将jquery ui设置为关注第一个表单元素? / p>
这里是带有模态对话框的页面的url只需单击Show the Dialog link
本页
您可以在jquery ui对话框中使用open事件,并将焦点设置为输入id。你可以这样做。
$(。selector)。dialog({
open:function( event,ui){$('#target')。focus();}
});
I am currently using the jquery UI modal box.
I am wondering how I can set the focus onto the first form element of the modal box when opening the dialog I think this is meant to happen by default but for some reason it is not.
How can I set the jquery ui to focus on the first form element when opening?
here is the url to the page with the modal dialog just click the Show the Dialog link on this page
You can make use of open event in jquery ui dialog and set the focus to the input id . You can do something like this.
$( ".selector" ).dialog({
open: function(event, ui) { $('#target').focus(); }
});
这篇关于Jquery UI模式对话框,将焦点设置在第一个表单元素上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!