How do I prevent event bubbling on subsequent clicks of button?
How do I prevent event bubbling on subsequent clicks of button?
Demo url: https://live.datatables.net/gadipiqu/1/edit
I am trying to trigger the verification process for an employee upon clicking the Verify
button in the modal. The issue is that upon subsequent clicks, the previous event is not detached and carried on to subsequent clicks (resulting in a loop of alerts). This issue is not present when I do not add the modal confirmation process and directly execute the verify function. I tried adding event.stopPropagation();
upon clicking Cancel
or Verify
but to no avail.
How do I solve this? Thanks for reading.
Answers
Turns out, I had to remove the event listener inside the event. Refactoring to the code below solved my issue.
Thanks for the update. Good to hear you've got it working.
Allan