SPlatten
SPlatten

Reputation: 5758

jQuery how to disable / enable Submit button in dialog

I have a dialog:

$("#ceresume").dialog({
  modal: true,
  draggable: true,
  resizable: false,
  position: {
    my: "center",
    at: "center",
    of: window
  },
  show: "blind",
  hide: "blind",
  height: DIALOG_HEIGHT,
  width: DIALOG_WIDTH,
  dialogClass: "ui-dialog-osx",
  buttons: {
    "Submit": function() {
      /// ...
    }
  }
});

I want to disable the Submit button so I tried this:

$("#ceresume, button:contains('Submit'])").prop("disabled", true);

Whilst:

$("#ceresume, button:contains('Submit'])")

Appears to return the correct results, setting the disabled attribute to true is not disabling the button. How do I do this?

Upvotes: 0

Views: 72

Answers (1)

rubenccdev
rubenccdev

Reputation: 161

The ] character inside the "contains" must be removed, it's causing an error.

So your command should be:

$("#ceresume,button:contains('Submit')").prop("disabled", true);

Upvotes: 1

Related Questions