AnsweredAssumed Answered

Form submission - scroll to top of page

Question asked by Moritz Trollmann on Feb 12, 2018
Latest reply on Feb 12, 2018 by Moritz Trollmann

Thanks to Sanford Whiteman I was able to add a thank you message after form submission.

The script works beautifully. What I would like to add is a scroll to the top of the page after submission but could not figure out how to do this.


I would appreciate it if someone could help me here.


Script used is:


<script src="//"></script>

<script src="//"></script>

<script src="//"></script>

<script>// <![CDATA[

MktoForms2.whenReady(function (form) {

    //Add an onSuccess handler

form.onSuccess(function(values, followUpUrl) {

     var email = form.vals().Email,

       firstName = form.vals().FirstName,

lastName = form.vals().LastName,

     html = "<h4 style='text-align: left;'>Thank you $firstName $lastName ($email) for your submission!<br/>Please check your email for a confirmation</h4>";

     html = html.replace("$firstName", firstName);

     html = html.replace("$email", email);

     html = html.replace("$lastName", lastName);


     // Get the form's jQuery element and hide it



     // Return false to prevent the submission handler from taking the lead to the follow up url


     return false;



// ]]></script>