Quantcast
Viewing all articles
Browse latest Browse all 5

Disable submit button on click

Are you looking for a JavaScript code to disable your HTML form submit button on first click to prevent double clicks ?
so here is the code Image may be NSFW.
Clik here to view.
:)
, it has been tested on IE 8 , Firefox 3.5 and Chrome. I am pretty sure it works on all browsers which support JavaScript.
Put the following code into <head> section of your page :

<script language="javascript" type="text/javascript">
function dis(){
frm=document.forms[0];
frm.submit.disabled=true;
}
</script>

and the following code into <form> section :

onsubmit="dis();"

for example :

<form method="post" action="/index.php" onsubmit="dis();">

Viewing all articles
Browse latest Browse all 5

Trending Articles