thepip3r thepip3r - 6 months ago 29
HTML Question

Div Overflow Scroll-to-bottom: Is it possible?

If I have a

div
with
overflow:auto
so that it is a scrollable
div
and I load it with information that makes a significant scroll area, is there a way that when I load the information, the
div
shows the bottom results? Or essentially scrolls to the bottom?

I've seen jQuery solutions but this is for use in an HTA so I cannot use jQuery. Is there a purely javascript way to accomplish this?

Answer
document.getElementById('mydiv').scrollTop = 9999999;

The scrollTop property specifies the scrolling offset in pixels from the top of the region. Setting it to a very large value will force it to the bottom.

Comments