I have a form with multiple input fields, such that before I get to the submit button I would have scrolled to the bottom of the page. I use jquery to submit the form without refreshing the page. When the form submits, the submit button area, i.e the bottom of the form is still being displayed. How can I adjust my code so that once the form is submitted, it returns to the top of the page without refreshing the page? My code is shown below.
Jquery
$("#sub").click( function() {
var content = tinyMCE.activeEditor.getContent();
$('textarea[name=texteditor]').val(content);
$.post( $("#myform2").attr("action"), $("#myform2").serialize(), function(info){ $("#result").html(info); } );
clearInput();
});
$("#myform2").submit( function() {
return false;
});
function clearInput() {
$("#myform2")[0].reset();
}