JQuery: autoscroll to last line of a div

Image you are working on a small web application where you use a JQuery UI dialog
to inform the user about the current process.

Triggered via SSE I am appending some messages via JavaScript.

$('#progress').append("" + stderr + "
");

In order to automaticly scroll to the last line I am using this two magic lines of JavaScript:

var height = $('#progress')[0].scrollHeight; $('#progress').scrollTop(height);

It is simple as that.

Open Hub profile for Christian Gmeiner