Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Thanked 0 Times in 0 Posts

    Form submit button that is also an anchor link?

    So I have a form for a mailing list, addes an eMail to a database ect...

    Although it's down a bit on the page, when the user clicks submit it jumps them to the top of the page. This is a bit of a problem because incase there is an error or it worked they would have to scroll back down to see it/ the message.

    Is there anyway to detect where the user's vertical location is on the page and when they click submit reaload the page to that same location, or can I use that form submit button to also go to an anchor location?

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 662 Times in 651 Posts
    <form action="#f" id="f">

    and then when you press submit the current page reloads at the top of the form.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts