简体   繁体   中英

jquery dialog - cannot disable button on open

I want to disable some buttons (with some additional conditions) on jquery dialog show and I am unable to do this. I tried many different ways and none of them worked. I am out of ideas.

Example code attached (in coffeescript):

$('#messages').dialog({
  height: 500,
  width: 800,
  resizable: false,
  modal: true,
  show: 'fade', 
  hide: 'clip',
  buttons: [
      {
      id: "msg-close",
      text: "Close",
      click: ->
        $('#msg-close').prop('disabled', true) //this one works
      }
    ],
  open: ->
    $('#msg-close').prop('disabled', true) //this one doesnt work
});

$('#msg-close').prop('disabled', true) //this one doesnt work

open expects a function like this

open: function () {
    $('#msg-close').prop('disabled', true);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM