jQuery prevent other events after a click

后端 未结 6 1016
谎友^
谎友^ 2020-12-14 07:15

I am trying to prevent multiple clicks on links and items, which is causing problems.

I am using jQuery to bind click events to buttons (jQuery UI) and image links (

6条回答
  •  攒了一身酷
    2020-12-14 07:50

    did you check out preventDefault?

    $("a").click(function(e) {
        e.preventDefault();
    }
    

    you could also try stopImmediatePropagation() or stopPropagation()


    You could also look into the one() event.

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

提交回复
热议问题