$("#bar").click(function(){ $("#foo").append("<p>Texto de ejemplo</p>"); document.getElementById("foo").lastChild.scrollIntoView(); });
<button id = "bar">AƱadir</button> <div id = "foo"> <p>Texto de ejemplo</p> </div>
#foo{ background: lightyellow; width: 15em; height: 5em; overflow: auto; border: .1em lightgray solid; } p{ margin: 0; } p:nth-child(even){ background: lightcyan; color: lightgreen; } p:nth-child(odd){ background: lightgreen; color: lightcyan; }