scroll to top of an element javascript code example
Example 1: javascript scroll to element
document.getElementById("divId").scrollIntoView();
Example 2: html scroll div to top
var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;