how to automatically scroll section to top in html code example
Example 1: html scroll div to top
var myDiv = document.getElementById('containerDiv');
myDiv.innerHTML = variableLongText;
myDiv.scrollTop = 0;
Example 2: scroll to a section of your page html
html {
scroll-behavior: smooth;
}