Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript need javascript help [1] Reply To: need javascript help [1]

#156614
Alen
Participant

getElementsByClassName returns an array of elements.

Since our two boxes are different, we have to select them individually. If we had many box1 then you would have to use for loop to style them. Since we know we only have one item in the array, using [0] selects the element we want.

http://codepen.io/alenabdula/pen/deAno