I want to make all li
elements turn to "Hello"
when I hit the Test Button
but querySelectorAll
doesn't do anything, but if I replace with querySelector
it works fine for just one element. What am I missing here?
function test() {
var foundDiv = document.querySelectorAll("li");
foundDiv.innerText = "Hello";
}
<body>
<div class="header">
</div>
<section id="container">
<ul>
<li class="first">one</li>
<li class="second">two</li>
<li class="third">three</li>
</ul>
<ol>
<li class="first">one</li>
<li class="second">two</li>
<li class="third">three</li>
</ol>
</section>
<div class="footer">
</div>
<button onclick="test()"> Test </button>
</body>