Disabling submit buttons with jquery

Submitting forms twice sometimes causes errors because resources aren’t available any more or a second request on a specific resource isn’t allowed. There are many reasons why submitting a form twice causes an error.

Some lines of jquery will help you prevent those errors:

1
2
3
4
5
6
7
$(function() {
var input=$("input:submit");
input.click(function () {
   $(this).attr("disabled", true);
   $(this).attr("value", "Submitting...");
});
});

Leave a Reply