JS Fiddle Demo
HTML
This is my spin on things.
I found that Audi Nugraha’s solution worked when testing, but not when I tried it in an Electron application.
A solution which did work for me was to position the cursor to the beginning and then blur/focus.
textarea.selectionEnd = textarea.selectionStart = position;
textarea.blur();
textarea.focus();
I have incorporated the above into a function:
function scrollTextarea(textarea,position) {
textarea.selectionEnd = textarea.selectionStart = position;
textarea.blur();
textarea.focus();
}