Disable a form button when a form is submitted using JQuery

Snippet to disable a ‘Save’ button when I submit a form. This checks client side validation, and if the form is valid for submission, it will disable the ‘Save’ button to prevent multiple clicks, and it will POST the form.

 $(document).ready(function() {
   $("#saveButton").click(function (e) {
      var form = $(this).parents('form:first');
      if ($(form).valid()) { 
         this.disabled = true;