forked from eda-old-challenges/dom-applying-classes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.js
38 lines (33 loc) · 1.02 KB
/
classes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Don't change or delete this line! It waits until the DOM has loaded, then calls
// the start function. More info:
// https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded
document.addEventListener('DOMContentLoaded', start)
function start () {
// The first example is done for you. Uncomment the line below and reload the browser.
one()
two()
three()
makeVisible()
// Your turn! Create a new function called `two`, then call it from here.
}
function one () {
// First, we have to find the element:
var one = document.getElementById('one')
// Next, we apply a new CSS class to it:
one.classList.add('blue')
}
// CREATE FUNCTION two HERE
function two() {
var two = document.getElementById('two')
two.classList.add('green')
}
// CREATE FUNCTION three HERE
function three() {
var three = document.getElementById('three')
three.classList.add('pink')
}
// CREATE FUNCTION makeVisible HERE
function makeVisible() {
var four = document.getElementsByClassName('invisible')
four[0].classList.add('visible')
}