$(document).ready(function () {
var dlg = $("#divIssAgent").dialog({
modal: true,
bgiframe: true,
autoOpen: false,
height: 142,
width: 560,
draggable: true,
resizeable: false,
buttons: {
Ok: function () {
$(this).dialog('close');
$('.ui-widget-overlay').attr("style", "position: absolute;");
$("#ctl00_hldPage_txtAWBPrefix").focus();
},
},
open: function (type, data) {
alert($(this).parents('.ui-dialog-buttonpane button:eq(0)').text());
var test=$(this).parents('.ui-dialog-buttonpane button:eq(0)').text();
$(this).parents('.ui-dialog-buttonpane button:eq(0)').focus();
alert("hello");
$(this).parent().appendTo($("form:first"));
$('.ui-widget-overlay').attr("style", "position: fixed; z-index: 1001");
//$(this).focus();
}
});
dlg.parent().appendTo($("form:first"));
$('.ui-dialog-titlebar-close').css("display", "none");
$('#divIssAgent').dialog('open');
});
最佳答案
您可以将类添加到文本为“确定”的按钮 如下:
buttons: {
**"OK": {
class: 'OK'
}**,
Ok: function() {
$(this).dialog('close');
$('.ui-widget-overlay').attr("style", "position: absolute;");
$("#ctl00_hldPage_txtAWBPrefix").focus();
}
}
您可以在
之后添加下划线$('#divIssAgent').dialog('open');
如下:
$('#divIssAgent').dialog('open');
$(".ui-dialog-button ok").focus();
关于javascript - 如何专注于javascript对话框 'OK'按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38910651/