【问题标题】:data-disable-with button option doesn't work on Chrome数据禁用按钮选项在 Chrome 上不起作用
【发布时间】:2013-10-28 08:57:19
【问题描述】:

以下 HTML 应在提交时相应地禁用和重命名按钮:

  <button data-disable-with="Please wait..." name="button" type="submit">Checkout</button>

但在 myChrome 浏览器中它什么也没做。 有什么我能做的吗?

我的 Chrome 版本是 30

【问题讨论】:

  • 您在问题中列出的标签表明您假设了一些原生 html 行为。为什么您的代码应该禁用并重命名提交按钮?
  • 对不起,我在 Rails/Jquery 环境中使用它
  • 我在 GitHub 上找到了这个参考,上面说问题待定github.com/rails/jquery-ujs/issues/306

标签: javascript jquery html ruby-on-rails-3


【解决方案1】:

data-disable-with 只能用于 rails 表单元素。但是如果你想将它应用到 HTML 表单元素上,你可以执行如下操作-

你可以试试data-loading-text="Loading..."连同一个js代码sn-p。

$("#btn1").on("click", function(){
    $(this).button("loading");
})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多