So, I'm experimenting with html/css/js
for the first time and I've encountered and issue that doesn't make much sense (at least to me).
So, when the page is loaded I insert some options in a <ul>
(The options are NOT there since the begginning). After all of the options have been inserted I try to get all of them using something along:
const dropdown = document.getElementById("selector");
const children = dropdown.childNodes;
However when I use console.log(children)
I'm getting something like this:
But when I use children.length
I'm getting the value of 0. What could I be doing wrong?
So, sry for the trouble but apparently I need to wait a bit before trying to fetch it all. I added a setTimeout to the function that retrieves it and now it works. Thanks all!