【问题标题】:Enable onMouseOut for disabled elements in the html为 html 中的禁用元素启用 onMouseOut
【发布时间】:2016-07-03 10:50:11
【问题描述】:

在 react-rails 中,onMouseOut 事件仅在元素未被禁用时才起作用。

以下是render方法中的代码:

dom.button
        type: 'submit'
        'data-toggle': "popover"
        title: "Form Requirements"
        'data-content': 'Please fill in all the form fields before submitting this form'
        'data-placement': "bottom"
        className: 'btn btn-primary'
        disabled: !@valid()
        onMouseEnter: @showPopOver
        onMouseOut: @hidePopOver
        'Create admin'

调用的对应方法如下所示:

showPopOver: function() {
  if (!this.valid()) {
    return $('[data-toggle="popover"]').popover('show');
  }
},
hidePopOver: function() {
  return $('[data-toggle="popover"]').popover('destroy');
},

【问题讨论】:

    标签: javascript ruby-on-rails-4 coffeescript onmouseout react-rails


    【解决方案1】:

    这就是 HTML 的工作原理。禁用元素没有事件。如果您希望触发事件,则必须通过其他方式使其“看起来”被禁用。

    【讨论】:

    • 但是 onMouseEnter 事件有效,那么为什么 onMouseOut 无效。这个事件在firefox上有效
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-21
    • 2021-01-23
    • 2015-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多