Scroll a multiline text to the bottom?

Can anyone help me get a multiline text field to scroll to the bottom?

I’m calling chatGPT and getting back my conversation. I’d like the long conversation to auto-scroll to the bottom. I added and HTML ID for that field, and I’m doing javascript to ‘getElementById’ and that’s working because I can write element.textContent to the console, but when I try to write element.scrollHeight to the console I get ‘undefined’.
I’m confused a bit by the different things I find about scrolling, much of it seems to be about scrolling the page to a certain element, but I want to force my single field to scroll to the bottom of its scrollbar range. Any help is appreciated.

well - now I got scrollHeight, I’m still new to camelCase and always want to CapitalizeTheFirstLetterToo - ugh!

So now i want to element.scrollTop = element.scrollHeight but that seems to do nothing.

Couple things to check:

  • make sure your text element is scrollable (overflow to auto or scroll)
  • check if your script loads only after the text was fully loaded
  • double check if id of the element matches the one you’ve provided

You can try debbuging this by using console.log(element.scrollHeight, element.scrollTop); (element being var element = document.getElementById('id');). If you don’t get it to work, post your full HTML here and we can work from there