Is there a generally cross-browser way to use JavaScript to make a div scroll all the way down?

Posted by Rayne on Stack Overflow See other posts from Stack Overflow or by Rayne
Published on 2010-05-08T19:05:12Z Indexed on 2010/05/08 19:08 UTC
Read the original article Hit count: 141

Filed under:

It looks like this:

var objDiv = document.getElementById("code");
objDiv.scrollTop = objDiv.clientHeight;

works in Chrome, but not FF, and this:

var objDiv = document.getElementById("code");
objDiv.scrollTop = objDiv.scrollHeight;

works in FF, but not Chrome.

Is there a better all around way to do this?

© Stack Overflow or respective owner

Related posts about JavaScript