Possible Duplicate:
jQuery/Javascript function to clear all the fields of a form
I need to clear the form after submit but none of the methods I've seen works for me. I'm using a script I bought but the author isn't answering my request. I have JS file with this:
$('#contact_form').submit(function () {
$.ajax({
type: 'POST',
url: 'contact.php',
data: {
name: $('#contact_form input#name').val(),
email: $("#contact_form input#email").val(),
text: $("#contact_form textarea").val()
},
success: function(data) {
if ( data == 'sent' ) {
$('#contact_form .status').html('Thanks');
} else if ( data == 'invalid' ) {
$('#contact_form .status').html('Invalid.');
} else {
$('#contact_form .status').html('Can't send message.');
}
},
error: function () {
$('#contact_form .status').html('Can't send message.');
}
});
return false;
});
}