The problem that dynamic rendering data can not be traversed when getting elements through class

according to the data returned by the background, it is displayed on the page (commodity editing function). The data is an array that needs to be rendered in a loop (but there is a set of arrays in it). The interior of the circular rendering also includes components referenced from the outside. Because the element is dynamically rendered based on the data, this component cannot be obtained using ref, so instead use class to get the sub-component element, and then loop to assign values to the elements in its page to reflect the data.
but now the problem is that you can get the list of sub-component elements after the loop (collection list), but cannot be traversed, that is, console.log (document.getElementsByClassName ("plaCate") [0]) is undefined, as shown in the following figure, traversal is terminated, and elements cannot be traversed. Ask for advice ~


I see you have two HTMLCollection objects in the console, the first time there are two elements, and the second time it is empty. Is it true that you have manipulated two div in the forEach loop, causing them to disappear from the page node?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bdb9e6-312af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bdb9e6-312af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?