Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ <h1 id="goButton" class="button">Go</h1>
<div id="goLight" class="bulb"></div>
</div>

</body>
<script src="js/jquery-2.1.4.js"></script>
<script src="js/app.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$(function(){
$("#stopButton").click(illuminateRed);
$("#slowButton").click(illuminateYellow);
$("#goButton").click(illuminateGreen);

function illuminateRed() {
console.log ("this is working");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chloeeffron good job using console.log() to help with your development and debugging. Just remember to remove this once you know its working and especially when you push your code.

// 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");
}

});