Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7623529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:43:45+00:00 2026-05-31T04:43:45+00:00

Upon searching StackOverflow for restoring scrollbar position using JavaScript, I came across this suggestion

  • 0

Upon searching StackOverflow for restoring scrollbar position using JavaScript, I came across this suggestion from https://stackoverflow.com/a/3812235/1101391

    document.getElementById("invoice_incomplete").scrollTop = 200px;

If I’m not mistaken, this code is somewhat related to what I really want to achieve. How can you actually save/remember/restore the position of the scrollbar on a <textarea> after reloading the page, and not just set your preferred scrollbar position?

Like when you type some paragraphs on the <textarea> and you reload the page, the scrollbar should be on its same position before reloading the page.

Edit:
Ended up using the onunload event, and an invisible <input> tag, as per mr. @ruakh’s suggestion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:43:46+00:00Added an answer on May 31, 2026 at 4:43 am

    You can save the value in an invisible text-field that serves no other purpose:

    <input style="display:none" id="scrollTop" />
    

    you can use a window.onunload event (hat-tip to katspaugh’s comment) to set

    document.getElementById('scrollTop').value = textarea.scrollTop;
    

    and a window.onload event to set

    textarea.scrollTop = document.getElementById('scrollTop').value;
    

    (The above assumes that textarea is a variable referring to the textarea).

    When the browser reloads the page, if it restores the form contents, then it will restore the contents of the invisible text-field together with the contents of the textarea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently searching for a 'technical article' I stumbled upon this Microsoft page: http://academic.research.microsoft.com/ .
Original question: here Upon searching i need to alter the results across rows which
This is what I'm referring to: http://twitter.github.com/bootstrap/components.html#badges Is badge the commonly agreed upon term?
Upon AD Import for SharePoint, MOSS does this automatically: Office SharePoint Server 2007 automatically
Upon clicking on a link, I am bringing in some images from a JSON
Continuing from a previous question , I keep searching for the optimal way to
I'm searching for a free ASP.NET profiler, and I stumbled upon EQATEC Profiler for
I've been searching through StackOverflow and I'm wondering about some things regarding AdMob. I'm
When one starts searching for PHP unit tests, one usually stumbles upon: PHPUnit. SimpleTest.
Update because of new insights : Upon seeing this question five years later, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.