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

Go

- + + + diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..bea3afa --- /dev/null +++ b/js/app.js @@ -0,0 +1,30 @@ +$(function(){ + $("#stopButton").click(illuminateRed); + $("#slowButton").click(illuminateYellow); + $("#goButton").click(illuminateGreen); + + function illuminateRed() { + console.log ("this is working"); + // clear whatever light is already illuminated + clearLights(); + // illuminate red light + $("#stopLight").css("background-color", "red"); + } + + function illuminateYellow() { + clearLights(); + $("#slowLight").css("background-color", "yellow"); + } + +function illuminateGreen() { + clearLights(); + $("#goLight").css("background-color", "green"); +} + +function clearLights(){ + $("#stopLight").css("backgroundColor", "black"); + $("#slowLight").css("backgroundColor", "black"); + $("#goLight").css("backgroundColor", "black"); +} + +}); \ No newline at end of file