Reset your form after submit using jQuery

Posted by & filed under Javascript, jQuery.

After you submit a form, you reset it with the following code: $(“form#myform”)[0].reset(); For example on my Magic8Ball website, I created a function to submit the form and reset it immediately, clearing out the input elements. var formData = $(“#form”).serializeArray(); $.ajax({ url : “speaktome.php”, type: “POST”, data : formData, success: function(result) { $(“.youranswer”).hide().html(” + result… Read more »