I'm currently learning web development with CSS, HTML and JavaScript.
This is my code:
const items = document.querySelectorAll('#players li');
console.log(items[0], items[1], items[2]);
<section id="players">
<h1>Test</h1>
<ol>
<li>Test1</li>
<li>Test2</li>
<li>Test3</li>
</ol>
</section>
What I want to do is to make a specific list item, let's say the third one to have a specific color. I can't figure out to how to use the style property to set the CSS-property color externally in my JavaScript file.
items[2].style.color = 'red';to have your third element in red color. See the documentation