开发者

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'); 
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜