I use a jQuery UI dialog that is made from HTML supplied from server. Code:
$("<div id='pastedial'>" + result.htmlPasteDialog + "</div>").dialog({
maxHeight: "85%",
minWidth: 700,
modal: true,
buttons: {
Cancel: function () {
// do cancel
},
"Paste!": function () {
// do action
}
// some other config
});
}
To dialog elements I attach event handler that validates the dialog. This works well. The validation function is just another function of page, that addresses dialog items based on their IDs that I know directly.
How I can address dialog's buttons from external function (that belongs to page) so I can disable actions if dialog is not validated?
Thanks in advance!
I use a jQuery UI dialog that is made from HTML supplied from server. Code:
$("<div id='pastedial'>" + result.htmlPasteDialog + "</div>").dialog({
maxHeight: "85%",
minWidth: 700,
modal: true,
buttons: {
Cancel: function () {
// do cancel
},
"Paste!": function () {
// do action
}
// some other config
});
}
To dialog elements I attach event handler that validates the dialog. This works well. The validation function is just another function of page, that addresses dialog items based on their IDs that I know directly.
How I can address dialog's buttons from external function (that belongs to page) so I can disable actions if dialog is not validated?
Thanks in advance!
Share Improve this question asked Nov 26, 2013 at 13:43 onkamionkami 9,44120 gold badges105 silver badges200 bronze badges2 Answers
Reset to default 3I use this, which is almost the same as Babblo, but searching for the caption of the button instead. Hope it helps.
function test() {
$("#pastedial")
.next(".ui-dialog-buttonpane")
.find("button:contains('Paste!')")
.button("option", "disabled", true);
}
You can access and disable the buttons with something like this:
function xxx(){
$('#pastedial').find('.ui-dialog-buttonpane button:eq(1)').attr('disabled','disabled');
}