You can use this code:
function scrollToLine($textarea, lineNumber) {
var lineHeight = parseInt($textarea.css('line-height'));
$textarea.scrollTop(lineNumber * lineHeight);
}
Some caveats about this code:
Also see our solution for scrolling a textarea to a given position with jQuery, which might work better for you. Also some other people have done crazy things Show archive.org snapshot .