How can I replace the contents of a scrollable div without jumping to the top?
Posted
by RenderIn
on Stack Overflow
See other posts from Stack Overflow
or by RenderIn
Published on 2010-04-26T13:51:45Z
Indexed on
2010/04/26
13:53 UTC
Read the original article
Hit count: 198
JavaScript
|jQuery
I have a div with the overflow: auto
style. It is populated via AJAX with a result table. The rows in this div are editable, and with each edit I refresh the contents. The problem is, if the user edits something at the bottom of the div, the refresh brings them back to the top.
I had some luck using anchors with Firefox, but not all versions of IE jumped to the anchors within the div.
Is there any way to replace the contents of a div like this without having the scrollbar jump to the top? Any other suggestions? I like to refresh the entire set of results rather than just the updated row if possible, but if there are no workarounds I guess I will pursue that instead.
© Stack Overflow or respective owner