Reputation: 7
I am using the code below to submit values to my db.
<input id="btn_'.$temp['id'].'" value="Confirm" style="background: #409940; border-radius: 10px; color: white;" type="button" onclick="validaLink(\''.$temp['id'].'\');">
Problem:
with in 2 secs , multiple clicks are submitted with the same value, till the div fads out.
What I have done:
I tried to disabled the form button after submit. but i guess 2 onclick events does not work.
suggestions / code corrections please
Upvotes: 0
Views: 215
Reputation: 388
The following code will disable the onclick event handler for the button after the first click, and also disable the button itself.
onclick="this.onclick=null;this.disabled = true;validaLink(\''.$temp['id'].'\');"
Upvotes: 0
Reputation: 1103
Try this
onclick="javascript:validaLink(\''.$temp['id'].'\'); this.disabled = true;"
Upvotes: 3