[英]how to do focus on javascripts dialogue box 'OK' button
$(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');
});
您可以按如下所示將類添加到具有“ OK”文本的按鈕:
buttons: {
**"OK": {
class: 'OK'
}**,
Ok: function() {
$(this).dialog('close');
$('.ui-widget-overlay').attr("style", "position: absolute;");
$("#ctl00_hldPage_txtAWBPrefix").focus();
}
}
您可以在之后添加下划線
$( '#divIssAgent')對話框( '開放')。
如下:
$('#divIssAgent').dialog('open');
$(".ui-dialog-button ok").focus();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.