jekillen Posted January 4, 2016 Share Posted January 4, 2016 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 More sharing options...
davej Posted January 4, 2016 Share Posted January 4, 2016 Perhaps resize? https://developer.mozilla.org/en-US/docs/Web/Events Link to comment Share on other sites More sharing options...
justsomeguy Posted January 4, 2016 Share Posted January 4, 2016 It doesn't look like the textarea has a scroll event, but you can use ajax to submit the text to the server so that the window stays open while it's being saved. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now