Preventing multiple clicks on button

后端 未结 14 1959
小鲜肉
小鲜肉 2020-12-02 09:43

I have following jQuery code to prevent double clicking a button. It works fine. I am using Page_ClientValidate() to ensure that the double click is prevented o

14条回答
  •  隐瞒了意图╮
    2020-12-02 10:36

    you can use jQuery's [one][1] :

    .one( events [, data ], handler ) Returns: jQuery

    Description: Attach a handler to an event for the elements. The handler is executed at most once per element per event type.

    see examples:

    using jQuery: https://codepen.io/loicjaouen/pen/RwweLVx

    // add an even listener that will run only once
    $("#click_here_button").one("click", once_callback);
    

提交回复
热议问题