0

i am new to jquery,i need to disable[grey out] the 'Cancel SUP' button which is an jquery BUTTON WIDGET.Below is my code..please some one help me in sorting out this issue

var buttons = {
'Exi1': function() {
$(this).dialog('close');
}
};
if(batch.SUPDELIVERYMETHOD === 'Email' && details.STATUS === 'VALID') {
buttons['Re-send SUP'] = resendPass;
}
if(details.STATUS === 'VALID') {
buttons['Cancel SUP'] = function() {
$('#dialog-confirm-cancelsup').dialog('open');
};
}

1 Answers1

0

Found an older answer here: How can I disable a button on a jQuery UI dialog?

You would use it like so:

https://jsfiddle.net/Twisty/ksk5skxy/

JavaScript

var btns = {
  "Exi1": function(e) {
    $(this).dialog('close');
  }
};
if (batch.SUPDELIVERYMETHOD === 'Email' && details.STATUS === 'VALID') {
  btns["Re-send SUP"] = resendPass;
}
if (details.STATUS === 'VALID') {
  btns["Cancel SUP"] = function(e) {
    $('#dialog-confirm-cancelsup').dialog('open');
  };
}

$(function() {
  $("#diag").dialog({
    buttons: btns,
    width: "400px"
  });
  $(".ui-dialog-buttonset button:contains('Cancel SUP')").button("disable");
});
Community
  • 1
  • 1
Twisty
  • 30,304
  • 2
  • 26
  • 45
  • @PradeepSubramani am glad to hear this helped. I hope you will mark it as the answer and upvote it if it was useful. – Twisty May 30 '17 at 12:28