I am implementing a dynamic content website. In particular, I have a "div" which I will update its content in the following way:
This is the "div":
<div id="informationONDevices"></div>
I proceed to delete its contents:
document.getElementById("informationONDevices").innerHTML = "";
Finally, I'm putting "divs" (the code that goes next is inside a loop):
var element = document.createElement("div");
element.innerHTML = "<h3>Dades de la sonda amb ID: " + this.responseXML.getElementsByTagName('addONDevices')[count1].childNodes[0].nodeValue + " i Alias: " + this.responseXML.getElementsByTagName('aliasONDevices')[count1].childNodes[0].nodeValue + "</h3>" + "<br><br>"
+ "<span class='title'>Actual</span><br>";
document.getElementById("informationONDevices").appendChild(element);
The problem is that every time you update the content of the "div" the page does autoscroll and does not stay where it was. Any solution? I've been searching and trying a lot of things and none of them has helped me.
Thank you very much!