scroll up on form completion

scroll up on form completion

Below is a block of code from a Wordpress plugin called "MM Forms", which handles form creation.

The part of the code belolw deals with what happens when a form is submitted, which I believe is around this part:

   if (1 == data.mailSent) {
      jQuery(data.into).find('form').resetForm().clearForm();
      mmfResponseOutput.addClass('mmf-mail-sent-ok');
   } else {
      mmfResponseOutput.addClass('mmf-mail-sent-ng');
   }
   mmfResponseOutput.append(data.message).fadeIn('fast');
   if (data.message.toLowerCase().indexOf('thanks')>=0)
   jQuery(data.into).find('form').hide();


From what I am gathering, this is resetting / clearing the form, fading in a sucess message div and hiding the form.

This is all great, but I want to add one other bit of functionality - to scroll to the top of the page.

Does anyone have any suggestions as to how the code coulod be modified to achieve this?

This seems to be the right direction:

http://flesler.blogspot.com/2008/02/jqu ... croll.html

But I'm struggling to see how it can integrate.

Many Thanks
    • Topic Participants

    • dave