When I type this
var sectionIntro = document.getElementsByClassName("section");
I get a list of my HTML.
However, when I try to take the first item in the array:
var sectionIntro = document.getElementsByClassName("section")[0];
I get undefined
.
What is happening?
My HTML:
<section class="section">
<div id="box1">
<p class="theQuote">" We ignited, now you spark "</p>
<p class="theQuoteW">~ Alumni</p>
</div>
<div class="introduction">
<div id="box2">
<h4 id="intro">Intro</h4>
I want to take the class="section"
using:
var sectionIntro = document.getElementsByClassName("section");