JavaScript Submit button hack



On slow server or double clicks often we have double post and double comments on blogs forum, forms, uploading etc. Here is a fast JavaScript hack that can disable the Submit button after the first click. So after the users click submit, the button will be inactive for other incidental clicks. Just with adding this following line to your form inside the "input submit" tag:


here is the an example:

<form name=myform action="form.php" method=post">

<input type="submit" value="Submit" onclick="myform.submit();this.disabled=true">


And here is a visual when I clicked on Host:


Hope you enjoy this short guide.

Get our hottest stories to your inbox.
Check your inbox for a confirmation email.

Have something to add to this story? Share it in the comments.