Can anyone tell me how can i use a variable for button text in jQuery UI dialog? I want to make a dynamic button name.
What you can do is assign the button in the dialog an ID and then manipulate it using standard jQuery.
$("#dialog_box").dialog({
autoOpen: false,
modal: true,
resizable: false,
buttons: [{
text: "Ok",
"id": "btnOk",
click: function () {
//okCallback();
},
}, {
text: "Cancel",
click: function () {
//cancelCallback();
},
}],
close: function () {
//do something
}
});
Set button text:
var newLabel = "Updated Label";
$("#btnOk").html('
')