In my HTML, I have a <div> called lastText at the bottom of another <div>. I need to click a button and scroll to the lastText. When I click on the button, it scrolls to the <div> but when I click it again it scrolls somewhere between top and bottom. When I scroll to somewhere in middle, and click on the button it doesn't scroll to the lastText. So basically scrolling is only working properly when I start to scroll from the very top. I need to scroll to lastText when click on the button from anywhere in the <div>. How can I solve this?
Here is the code: