how to prevent link button multiple click .before submitting first data again click 2 or 3 times same data is saving more than once in data base. i mean continues click in the sumit button data is saving repeatedly .
Loading
how to prevent link button multiple click .before submitting first data again click 2 or 3 times same data is saving more than once in data base. i mean continues click in the sumit button data is saving repeatedly .
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Aravind GovindarajPosted May 13, 2023, 7:41 PM
Please use event prevent default option.
https://www.w3schools.com/jsref/event_preventdefault.asp
Naimish MakwanaPosted May 13, 2023, 12:38 PM
One way to prevent multiple clicks on a link button or submit button is to disable the button after the first click. This can be done using JavaScript.
Here's an example of how to disable a button using jQuery:
Add the jQuery library to your HTML file. You can do this by including the following code in your head section:
Add an event listener to the button that will disable it when clicked:
In this example,
#myButtonis the ID of the button you want to disable.When the button is clicked, the
prop('disabled', true)function will be called, which will disable the button.Note that you'll need to include this code after the jQuery library has been loaded.
You can also add a message or spinner to indicate that the button has been clicked and the form is being processed:
In this example, the button text is changed to 'Processing...' when the button is clicked.
Once the form has been submitted and the data has been saved to the database, you can re-enable the button using the following code:
Thanks