I am encountering a small issue with scrolling a pop-up window. I am trying to scroll a popup that contains a div and some CSS code without using an ID or class.
Here is the HTML CSS Code snippet:
<div style="height: 356px; overflow: hidden auto;">
Below is the JavaScript code I have attempted:
var objDiv = document.getElementsByTagName("div");
objDiv[0].scrollTop = objDiv[0].scrollHeight;
The same code works for classes and IDs as well:
<div class="123">
JavaScript code for classes:
var objDiv = document.getElementsByClass("123");
objDiv[0].scrollTop = objDiv[0].scrollHeight;
This relates to an Instagram-like pop-up. I am seeking a way to scroll using either a div, a CSS selector, or both simultaneously with JavaScript code.