是否可以在jQuery UI对话框中设置按钮的ID,以便稍后通过jQuery引用它们?例如,触发事件,禁用等?
... in the dialog setup ...
buttons: {
"Sök": function () {
var bValid = true;
},
"OK": function () {
if (OK()) {
getStuffNoteringar($("#txtStuffId").val());
$(this).dialog("close");
}
}
.... later on in some javascript code....
$('#OK').click();
Run Code Online (Sandbox Code Playgroud) 试图动态更改多个jQuery UI对话框()按钮.
下面代码的问题是在对话框的第一个实例中只显示一个按钮().应显示两个按钮.
$(function(){
var dlg = $('#message');
dlg.dialog({
autoOpen:false,
modal:true,
width: 500,
close: function() {
if (seen==0 && ans > 0) {
cnt++;
seen++;
dlg.html('Here is a second message');
dlg.dialog(
'option',
'buttons',
[{
text: 'OK',
click: function() {
$(this).dialog('close');
}
}]
);
dlg.dialog('open');
}
}
});
$('#myDiv').hover(
function() {
//Hover-in
if (cnt < 1 || (cnt > 2 && cnt < 4) || (cnt > 5 && cnt < 7)) {
var msg = 'First display text …Run Code Online (Sandbox Code Playgroud) 我希望能够在运行时更改模态和按钮的标题.目前我有这个我有批准或拒绝的行动
var recButton = actions =='approval' ? 'Approve' : 'Deny';
$("#dialog").dialog(
{
modal : true,
buttons : {
'update all' : function() {
// window.location.reload();
// $( this ).dialog( "close" );
//do something here
},
Cancel : function() {
$(this).dialog("close");
}
}
}); //dialog
});
Run Code Online (Sandbox Code Playgroud)
我也尝试过这个按钮
$("#dialog").dialog(
{
modal : true,
buttons : {
recButton : function() { ...
Run Code Online (Sandbox Code Playgroud)
但在模态中它没有很好地转换,只是说recButton而不是变量值.我也需要更改标题.
更新:通过简单标题获得标题: