向JQuery对话框底部按钮添加名称
我正在尝试向底部面板上的按钮添加名称(而不是显示的文本),但找不到方法 这就是我目前所拥有的向JQuery对话框底部按钮添加名称,jquery,jquery-ui,Jquery,Jquery Ui,我正在尝试向底部面板上的按钮添加名称(而不是显示的文本),但找不到方法 这就是我目前所拥有的 $("#dialog-import-from-existing").dialog({ title: "Import From Existing", autoOpen: false, modal: true, draggable: false, resizable: false, width: 500,
$("#dialog-import-from-existing").dialog({
title: "Import From Existing",
autoOpen: false,
modal: true,
draggable: false,
resizable: false,
width: 500,
height: 525,
buttons: {
**name : "SubmitButton",**
"Import": function() {
$('#CreateForm').submit();
$(this).dialog('close');
},
"Cancel": function() {
//Need to added the js files to Driver studio.
//$("models-to-add-container").effect("explode");
$(this).dialog('close');
}
}
});
我正在尝试使用名为“SubmitButton”的按钮
提前感谢。试试:
$("#dialog-import-from-existing").dialog({
...
open: function() {
$(this).parent().find('.ui-dialog-buttonpane button:contains("Import")').
attr('name', 'SubmitButton');
}
});
(由改进而来)按钮选项有两个API。您正在使用原始的、更简单的API将按钮标签映射到单击函数。您还可以使用对象数组,这将为您提供更多的控制
$( "#dialog-import-from-existing" ).dialog({
...
buttons: [
{
name: "SubmitButton",
text: "Import",
click: function() {
$( "#CreateForm" ).submit();
$( this ).dialog( "close" );
}
},
{
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
}
}
]
});
此API允许您传递任何可以传递给.attr()
plus事件处理程序的内容