In this code:
<header class="alg">Some text</header>
<script>
var header = document.getElementsByClassName("alg");
header.style.color = 'red';
</script>
after run it. I got from log:
TypeError: header_m.style is undefined
What do I do wrong?
In this code:
<header class="alg">Some text</header>
<script>
var header = document.getElementsByClassName("alg");
header.style.color = 'red';
</script>
after run it. I got from log:
TypeError: header_m.style is undefined
What do I do wrong?
 
    
    getElementsByClassName returns multiple elements. 
Therefore, you are accessing it improperly. What you want, in this case, is:
 header[0].style.color = 'red';
  //    ^ [0] will get the first element with the class, 
  // which is in this case your is header element. [1] would get the second, etc.
