I am creating a chat using Ajax requests and I\'m trying to get messages div to scroll to the bottom without much luck.
I am wrapping everything in this div:
If this is being done for scrolling to the bottom of chat window, do the following
The idea of scrolling to a particular div in the chat was the following
1) Each chat div consisting of Person, time and message is run in a for loop with class chatContentbox
2) querySelectorAll finds all such arrays. It could be 400 nodes (400 chats)
3) go to the last one
4) scrollIntoView()
let lastChatBox = document.querySelectorAll('.chatContentBox');
lastChatBox = lastChatBox[lastChatBox.length-1];
lastChatBox.scrollIntoView();