diff --git a/index.html b/index.html index e5f8fea..17398d8 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,10 @@ Stoplight Exercise +
diff --git a/index.js b/index.js index 03cc920..6c59149 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,35 @@ -(function() { - 'use strict'; +'use strict'; +$(function() { - // YOUR CODE HERE -})(); + var buttonsss = document.getElementById('controls') + var theBulbs = document.getElementsByClassName('bulb') + // console.log(theBulbs.); + + buttonsss.addEventListener("click", function(ev) { + console.log(ev.target); + $('#stopLight').css({ + backgroundColor: '#111' + }) + $('#slowLight').css({ + backgroundColor: '#111' + }) + $('#goLight').css({ + backgroundColor: '#111' + }) + switch (ev.target.textContent) { + case 'Stop': + return document.getElementById('stopLight').style.backgroundColor = 'red'; + break; + case 'Slow': + return document.getElementById('slowLight').style.backgroundColor = 'orange'; + break; + case 'Go': + return document.getElementById('goLight').style.backgroundColor = 'green'; + break; + default: + theBulbs.style.backgroundColor = '#111' + } + + }) + +});