简体   繁体   English

jQuery对话框-无法禁用打开按钮

[英]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. 我想禁用jquery对话框显示中的某些按钮(带有一些其他条件),但我无法执行此操作。 I tried many different ways and none of them worked. 我尝试了许多不同的方法,但没有一个起作用。 I am out of ideas. 我没主意。

Example code attached (in coffeescript): 附带的示例代码(在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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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