I've decided to make a post about the questions I get during studying so I can check it out in the future.
JavaScript
πββοΈ How to make several elements to change the properties using DOM querySelectorAll?
[HTML]
<h1>test</h1>
<ul>
<li class = "item">1</li>
<li class = "item">2</li>
<li class = "item">3</li>
</ul>
[JavaScript]
document.querySelector("item").style.color = "red";
above will just change the colour of first item which is "1"
β I have found the answer!
I should have used the
for loop
to make all red. in the order of[0] -> [1] -> [2]
πββοΈ How to set onclick on <a>
tag?
I want to change the colour of text which has Tag but it doesn't workπ
β I have found the answer!
I've changed the selector tag to
<a>
instead of<p>
and it worked! but why? do I need to specify the tag the one which is very close to the content?
Β