JS: How to prevent form being submited several times?
Simple form without validation. I don't want form being submited开发者_如何学Python more than one time if user pushes submit button several times (i.e. due internet lag, or something else). I'm interested in a client side solution. jQuery or simple JavaScript are acceptable.
Thanks.
You can disable the submit button:
$('form').submit(function() {
$(this).find(':submit').attr('disabled', true).text("Please wait...");
});
Maybe something like that:
$('input[type=submit]').click(function(){
$(this).attr('disabled','disabled');
});
精彩评论