【问题标题】:How to disable a button after click in limejs单击limejs后如何禁用按钮
【发布时间】:2013-09-09 18:31:30
【问题描述】:

点击limejs后如何禁用按钮?我试过使用

    this.disable()

但它不起作用。

【问题讨论】:

  • 您应该扩展您的代码以显示 this 的上下文以获得更高质量的答案。

标签: limejs


【解决方案1】:

您也可以使用goog.events.listenOnce。与 goog.events.listen 的签名相同,并且只会触发一次。

【讨论】:

    【解决方案2】:

    试试 goog.events.listen 和 goog.events.unlisten:

    goog.events.listen(my_button, ['mousedown','touchstart'],function_triggered_onClick);
    goog.events.unlisten(my_button, ['mousedown','touchstart'],function_triggered_onClick);
    

    goog.events.unlisten 将禁用按钮,直到代码再次到达 goog.events.listen

    【讨论】:

      猜你喜欢
      • 2019-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-25
      • 1970-01-01
      • 2011-01-20
      相关资源
      最近更新 更多