diff --git a/index.html b/index.html index 0180c07..baae8e6 100644 --- a/index.html +++ b/index.html @@ -23,5 +23,7 @@

Go

+ + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..5fd2785 --- /dev/null +++ b/js/index.js @@ -0,0 +1,28 @@ +$(document).ready(function(){ + + $('#stopButton').click(illuminateRed); + $('#slowButton').click(illuminateYellow); + $('#goButton').click(illuminateGreen); + + function illuminateRed() { + clearLights(); + $('#stopLight').css('backgroundColor', 'red'); + } + + function illuminateYellow() { + clearLights(); + $('#slowLight').css('backgroundColor', 'yellow'); + } + + function illuminateGreen() { + clearLights(); + $('#goLight').css('backgroundColor', 'green'); + } + + function clearLights() { + $('#stopLight').css('backgroundColor', 'black') + $('#slowLight').css('backgroundColor', 'black') + $('#goLight').css('backgroundColor', 'black') + } + +});