As I delve into the world of HTML and JS, I came across the document.querySelectorAll()
API. It allows me to target
document.querySelectorAll('#example-container li:first-child');
to select the first child within a list with the ID 'example-container'.
This led me to wonder if
document.querySelectorAll('#example-container li:second-child');
would select the second child in the list with the ID 'example-container'.
However, it turns out that I was mistaken. This left me puzzled about how to access the second or third item in the list using querySelectorAll()
.
Here is the HTML code snippet:
<div id="example-container">
<ul>
<li class="feature">Luxurious sized master suite</li>
<li class="feature">Oversized walk-in closet</li>
<li class="feature">Frameless Beech cabinetry with concealed hinges</li>
<li class="feature">Elegant slab white quartz countertops with large backsplash</li>
<li class="feature">Dual china sinks with Moen faucets</li>
<li class="feature">Clear frameless shower enclosures</li>
</ul>