Jump to content

Detection of scroll in textarea element?


Recommended Posts

I have developed a web based text editor that I use for editing text files on

a site that are owned by the web server user account (unix type system).


These file contains many hundreds of lines of code (including comment blocks).


When the contents of the text file is displayed in a textarea for editing of text,

it overflows the visible area of the textarea element.


I can scroll in the textarea with mouse scroll ball*, but no scroll bars are visible

unless I scroll into the overflow area to the right of the textarea. There is a left/right

scroll bar on the bottom, but that is part of the div that the textarea is nested in.


*using an Apple mouse in Firefox on Mac OSX; Firefox is the primary client used

for development.


Is there an event type that I can monitor in js code to record the scrollHeight value?

Or am I limited to recording it in a blur event handler? The textarea is generally focused

when the 'Save' processing is executed.


I want to be able to save the scrollHeight value when the user clicks 'Save' to save the

edits. The contents of the textarea will be sent to server php code to overwrite the file

with the edited version. When the 'Save' processing is done, I want the textarea to auto

scroll to the last scrollHeight value recorded when 'Save' was executed.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...