scroll html element code example
Example 1: js scrolling in div
var divElement = document.getElementById("div");
divElement.scroll({
top: divElement.scrollHeight,//scroll to the bottom of the element
behavior: 'smooth' //auto, smooth, initial, inherit
});
Example 2: html scroll div to top
var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;