【问题标题】:Disable chosen element with PrototypeJS not working in Firefox禁用 PrototypeJS 的选定元素在 Firefox 中不起作用
【发布时间】:2017-04-05 01:28:16
【问题描述】:

我正在尝试以编程方式禁用所选元素,它在 Firefox 中不起作用,但在 Chrome 中起作用。

$$('select[multiple].chosen').each(function(element) { new Chosen(element); });

var MY_SELECT = $$('select[multiple].chosen')[0];

$('disable-button').on('click', 'button', function(event, element) {
    $('fruitsid').disabled=true;
    $('fruitsid').fire("chosen:updated");
});

这是一个 JSFiddle:http://jsfiddle.net/y79rm2dk/2/

.fire 似乎不适用于 Firefox 中的禁用元素?

【问题讨论】:

    标签: javascript firefox prototypejs prototype-chosen


    【解决方案1】:

    尝试使用

    $('fruitsid').writeAttribute('disabled',true);
    

    而不是

    $('fruitsid').disabled=true;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-20
      • 1970-01-01
      • 2021-07-21
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多