Now, that’s quite a headline. And this post will explain just the simple concept posted in the headline. How to avoid (at least) firefox from scrolling to the top when you insert content into a textarea.
It’s simple. Very simple. And it was shown to be so very simple for someone who didn’t remember scrollTop by this thread.
In jQuery (which we use with the caret plugin):
currentScrollPosition = $("#textareaId").scrollTop();
/* do stuff */
$("#textareaId").scrollTop(currentScrollPosition);
Yep. So simple that it actually hurts a bit.
Thanks for the post. Wow, you gave me the answer that tortured me for severaal days. I ndint know how to avoid firefox from scrolling to the top when I insert content into a textarea. Now, I see it is really very simple) Thanks again!
Exactly what i was looking for all night long! Thanks!