So i read 10+ Threads about this but still didnt find a solution.
I want to autoscroll to the bottom but always the main div is scrolled not the one i want.
The autoscroll must be in div2
My code:
<div id="wrapper">
<div id="div2">
<div id="autoscroll"></div>
</div>
</div>
My attempts(both autoscroll the wrong div)
<script>
window.addEventListener('load', function() {
const d = document.querySelector('#autoscroll');
d.scrollIntoView();
});
</script>
<script>
$("#autoscroll")[0].scrollIntoView({
behavior: "smooth", // or "auto" or "instant"
block: "end" // or "end"
});
</script>
I was expecting to autoscroll the right div.
New contributor
Anton is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.