I have a form with different input fields: textarea, checkbox, radio button, text input and select input. I am using jquery to submit this to database without refreshing the page which works perfectly. But the problem is that jquery does not clear the contents from the fields after submitting. Checkbox and radio button are still checked. Research I made on this site says that this issue will be fixed by using jQuery's each function. I did it, but it did not work. Please what did I do wrong in my code. My jquery code is shown below.
Jquery
$("#sub").click( function() {
var content = tinyMCE.activeEditor.getContent();
$('textarea[name=texteditor]').val(content);
$.post( $("#myform").attr("action"), $("#myform").serialize(), function(info){ $("#result").html(info); } );
clearInput();
});
$("#myform").submit( function() {
return false;
});
function clearInput() {
$("#input").each( function() {
$(this).val('');
});
}