Sometimes when we do dynamic growth DIV, we generally use the content of the content of the content to the bottom, but this will bring a more painful problem, that is, the newly added content will be covered at the bottom, such as this that is like this
How can we let Scrollbar move the bottom automatically? This requires the help of JS. Assuming the DIV's ID is mydiv, then the native JS is implemented as follows:
Copy code code as follows:
var mydiv = document.GetelementByid ('mydiv');
mydiv.scrolltop = mydiv.scrollheight;
If you use jQuery, it is also very simple
Copy code code as follows:
var $ div = $ ('#mydiv');
$ div.scrolltop ($ div [0] .scrollhead);