jQuery click events firing multiple times

后端 未结 25 2797
不知归路
不知归路 2020-11-22 11:01

I\'m attempting to write a video poker game in Javascript as a way of getting the basics of it down, and I\'ve run into a problem where the jQuery click event handlers are f

25条回答
  •  清歌不尽
    2020-11-22 11:36

    If you find that .off() .unbind() or .stopPropagation() still doesn't fix your specific issue, try using .stopImmediatePropagation() Works great in situations when you just want your event to be handled without any bubbling and without effecting any other events already being handled. Something like:

    $(".bet").click(function(event) {
      event.stopImmediatePropagation();
      //Do Stuff
    });
    

    does the trick!

提交回复
热议问题