Prevent Submit Button From Clicking Twice

I have a bug where a user is able to pay more than once if they quickly fill out the payment form and click the submit button very fast (more than once).

I need to follow content security policy so that means no inline javascript.

I have some code that disables the button after the first click, but the problem is the form does not submit. I would appreciate any help.

I am not sure if I need to combine the two javascripts somehow. Without the top javascript code, the form validates and submits fine but it has that bug.


marketing agencies in mumbai flat for sale in dombivli

Hey there,

can you show us some code to reproduce the problem?

Assuming you’re using addEventListener(...) to attach your listener function (and that its a named function…), you do have an option: removeEventListener().

Here’s the theory - the button gets clicked, the named event listener is removed from the element, processing happens, and then, optionally, the event listener can be reattached.