My HTML is based on several boxes or containers, here's an ilustrative example of the code:
<div id="box">
<div id="board">
<div class="project" id="project-0">
<h4 class="project-title">To-Do's<i class="arrowproject"></i></h4>
<div class="todo" id="todo-0">
<h4 class="todo-title">To-Do 1<i class="far fa-check-circle"></i><i class="arrowtodo" id="arrowtodo-0"></i></h4>
<div class="todo-box">
<!-- Here goes the to-do's details -->
</div>
</div>
</div>
</div>
</div>
My goal is to select every <i class="arrowtodo" id="arrowtodo-0"></i>
with querySelectorAll()
and add an onClick
listener for tab handling since that structure is added dynamically and is repeated. Simple.
The issue here is that querySelectorAll()
and every other DOM method like getElementById()
and so on, are reaching only to the h4
tag and when I try to select the element that I want or any other element beyond the h4
like <div class="todo" id="todo-0">
, it returns an empty NodeList
.
The funny thing is if I select the <div class="project" id="project-0">
tag and console.log()
, it succesfully selects all the content and I can see its children with no problem.
I really don't know what's happening. I'm starting to assume that there's a limit to nesting elements but when I searched online the limit it's way beyond 4 (that's the amount of levels that I have in my code).
Does anyone came across with this issue and fixed it or know what's going on?
Thanks in advance.