Safe Submit With jQuery

This is just a way to prevent multiple form submissions.

What this will do is disable all form inputs when form submit button is clicked to prevent multiple form submission.
Then We will enable all the form inputs after a successful form submission.

The jQuery

    //Disable form inputs
    $(":input").attr("disabled", true);
    var dataString =  'name=test';
    type: "POST",
    url: "1.php",
    data: dataString,
    success: function(){
    //Enable form inputs after form successfully submitted
    return false;


     Name:<input type="test" name="name" id="name" />
     <input type="submit" name="submit" id="submit" />

Tags: , , , ,

Monday, February 21st, 2011 Tutorials

1 Comment to Safe Submit With jQuery

  • Leslie Moss says:

    Just what I needed.

  • Leave a Reply