Search code examples
javascriptformscontacts

When reload, page jumps to random section


I am using this tutorial for the contact form of my website :

http://code.tutsplus.com/tutorials/build-a-neat-html5-powered-contact-form--net-20426

The form works great, however when the page is first loaded and even when it is reloaded, it automatically jumps to the contact section.

To see what I mean: http://averyeliasdesign.com/portfolio_original/

And this is what the website should actually do (load to the top of the page or wherever you left off): http://www.averyeliasdesign.com/

I'm assuming it has something to do with the javascript but I can't figure it out. If anyone could help me out that would be wonderful!


Solution

  • You need to remove this:

    The autofocus attribute is giving that field focus and the browser is scrolling the focused field into view.