I'm doing the freeCodeCamp Simon Game challenge (JSfiddle). I can't work out why my .click() isn't working at all. I've used this for all of my other projects without issue.
The HTML is here:
<span class="title-label">designed and coded by <a href="http://www.daveingles.com" id="linkedIn" target="_blank">Dave Cook</a></span>
</div>
<div class="main">
<div class="button-holder">
<div class="quarter red">
<div id="red"></div>
</div>
<!--quarter red-->
<div class="quarter yellow">
<div id="yellow"></div>
</div>
<!--quarter red-->
<div class="quarter green">
<div id="green"></div>
</div>
<!--quarter red-->
<div class="quarter blue">
<div id="blue"></div>
</div>
<!--quarter red-->
<div class="center">
<h1 id="simon">Simon</h1>
<div class="center-row">
<div class="center-cell">
<div class="screen">--</div>
</div><!--cell-->
<div class="center-cell">
<div class="btn r"></div>
</div><!--cell-->
<div class="center-cell">
<div id="strict-light"></div>
<div class="btn y"></div>
</div><!--cell-->
<div class="center-cell">
<span>COUNT</span>
</div><!--cell-->
<div class="center-cell">
<span> START</span>
</div><!--cell-->
<div class="center-cell">
<span>STRICT</span>
</div><!--cell-->
</div><!--center-row-->
<div class="bottom-row">
<div class="center-cell">
<span>OFF</span>
</div>
<div class="center-cell">
<div class="off-on">
<div id="switch"></div>
</div>
</div>
<div class="center-cell">
<span>ON</span>
</div>
</div><!--bottom-row-->
</div>
<!--center-->
</div>
<!--button-holder-->
</div>
<!--main-->
This is the JavaScript:
$("*").click(function(){
console.log($(this));
activateSection("red");
});
$("#yellow").click(function(){
console.log($(this));
activateSection("yellow");
});
The first click function works fine so I can be sure that JQuery is installed and the syntax is correct. Whenever I try to put a specific class or id in the element selector, nothing happens.
divwith idyellowdoes not have any dimensions<body>and<html>sections initially. I assume this is caused by the same issue.