我正在尝试为底部面板上的按钮添加名称(而不是显示的文本),但找不到方法。
这就是我目前所知道的..。
$("#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“的按钮。
提前谢谢。
发布于 2011-10-18 20:30:20
按钮选项有两个接口。您使用的是原始的、更简单的API,即将按钮标签映射到click函数。您还可以使用对象数组,这将为您提供更多的控制。
$( "#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()和事件处理程序的内容。
发布于 2011-10-18 06:05:04
尝试:
$("#dialog-import-from-existing").dialog({
...
open: function() {
$(this).parent().find('.ui-dialog-buttonpane button:contains("Import")').
attr('name', 'SubmitButton');
}
});https://stackoverflow.com/questions/7800091
复制相似问题