How to scroll to bottom on an overflow

I am creating a chat app
I want to scroll to bottom of a container (set to overflow) when workflow is run

I tried js

var element = document.querySelector(“.chat-box”);
element.scrollTop = element.scrollHeight;

but its not recognizing the element.

Is there a fix for this ?

Fixed it myself.

Here is how it was done for anyone who has the same issue.

var element = wwLib.getFrontDocument().getElementById('chatContainerBox');
1 Like

This made it scroll to the top for me, and I can’t quite figure out how to reverse it.

I have a method that seems to work for my use-case which is similar to yours and I posted it here: Anyone figure out “scroll to” as part of workflow? - Ask us anything / How do I? - WeWeb Community