How do I scroll a row of a table into view (element.scrollintoView) using jQuery?

jquery, scroll

Solution

var rowpos = $('#table tr:last').position();

$('#container').scrollTop(rowpos.top);

should do the trick!

Problem

I'm dynamically adding rows to a table using jQuery. The `table` is inside a `div` which has `overflow:auto` thus causing a vertical scrollbar. I now want to autoscroll my container `div` to the last row. What's the jQuery version of `tr.scrollintoView()`?

Original source

Related problems