Switch to full style
JQuery Examples
Post a reply

avoid multiple submit of form, prevent more than one press

Thu Jan 17, 2013 12:56 am

avoid multiple submit Example, prevent more than one press on submit button in form code example using JQuery.
javascript code
<html>
<head>
<title>avoid multiple submit Example</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function() {
$('form#Once').submit(function() {
if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
jQuery.data(this, "disabledOnSubmit", { submited: true });
$('input[type=submit], input[type=button]', this).each(function() {
$(this).attr("disabled", "disabled");
});
return true;
}
else
{
return false;
}
});
});
</script>


</head>
<body>
<center>
<form action="#" method="GET" id="Once">
<table border="1">
<tr>
<td><strong>username:</strong></td><td><input type="text" name="username" />
</tr>
<tr>
<td><strong>password:</strong></td><td><input type="text" name="password" />
</tr>
<tr>
<td colspan="2">
<center><input type="submit" value="submit" />
</td>

</form>
</center>

</body>

</html>




Post a reply
  Related Posts  to : avoid multiple submit of form, prevent more than one press
 avoid multiple submit clicks using javascript     -  
 Disable submit button until all form's fields are filled     -  
 How Can I Avoid Domain Renewal Problems?     -  
 avoid showing/printing figures, text after conclusion     -  
 php login form (sign-in form)     -  
 Multiple Inheritance     -  
 Using Multiple Values for a Cookie in php     -  
 Jtable with multiple headings     -  
 Multiple Exception Catching     -  
 Code to open multiple links.     -  

Topic Tags

JQuery GET/POST