Created
August 16, 2010 19:03
-
-
Save iirving/527536 to your computer and use it in GitHub Desktop.
as per Adding a “loading” image to (just about) any form on submit, with jQquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="javascript" type="text/javascript"> | |
$("form").submit(function() { | |
if ($('#loading_image').length == 0) { //is the image on the form yet? | |
// add it just before the submit button | |
$(':submit').before('<img src="/images/ajax-loader.gif" style="display: none;" alt="loading" id="loading_image">') | |
} | |
$('#loading_image').show(); // show the animated image | |
$(':submit',this).attr('disabled','disabled'); // disable double submits | |
return true; // allow regular form submission | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
all explained at http://www.falsepositives.com/index.php/2010/08/16/show-a-loading-image-to-any-form-with-ajax-and-jquery/ Adding a “loading” image to (just about) any form on submit, with jQquery