I'm facing an issue with a scroll-bar inside a div element. Initially, the position of the scroll-bar is at the top. However, whenever I add text to the div element, the scroll-bar remains in its initial position and does not automatically move to the bottom. Is there a way to ensure that the scroll-bar of the div element is always positioned at the bottom, and that it moves to the bottom automatically whenever text is added?
Below is the code for my div element:
<div class='panel-Body scroll' id='messageBody'></div>
Here is the CSS class:
.scroll {
height: 450px;
overflow: scroll;
}
What I am looking for is to have the scroll-bar initially positioned at the bottom.
Additionally, when I click on "send message," the message gets added to the 'messageBody' div element. At that moment, I also want the scroll-bar to automatically move to the bottom.
Currently, my scroll-bar looks like this: https://i.sstatic.net/OYcQ6.png
But I would like it to look like this consistently: https://i.sstatic.net/7zw1c.png
Thank you in advance.