title: How to clear input data after form submit
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11635116/cant-clear-the-input-value-after-form-is-submited">Can&#39;t clear the input value after form is submited</a>  </p>
  </blockquote>
  
  
  
  <p>Ok, so I tried a 100 times. I need to clear input data after validation and submitting the form. Then the wrapper div will fade out.  So, validate, submit, clear data, fade out. I have a feeling that I don't put the val('') in the right place. If anyone wants to help.. thanks.</p>
  
  <pre><code>$(document).ready(function () {
      $('#form1').ajaxForm({
          beforeSubmit: validate
      });
  
      function validate(formData, jqForm, options) {
          var name = $('input[name=name]').fieldValue();
          var email = $('input[name=email]').fieldValue();
          var message = $('textarea[name=message]').fieldValue();
  
          if (!name[0]) {
              alert('Please enter a value for name');
              return false;
          }
          if (!email[0]) {
              alert('Please enter a value for email');
              return false;
          }
          if (!message[0]) {
              alert('Please enter a value for message');
              return false;
          }
      }
  
      var name = $('input[name=name]').val('');
      var email = $('input[name=email]').val('');
      var message = $('textarea[name=message]').html('');
  
      $("#form1").ajaxForm(function () {
          $("#formplic").fadeOut(1000, function () {
              $(this).html("&lt;img src='images/postauto2.png'/&gt;").fadeIn(2000);
          });
      });
  });
  </code></pre>