javascript - JQuery .click() not selecting elements -
i'm doing freecodecamp simon game challenge (jsfiddle). can't work out why .click() isn't working @ all. i've used of other projects without issue.
the html here:
<span class="title-label">designed , coded <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 javascript:
$("*").click(function(){ console.log($(this)); activatesection("red"); }); $("#yellow").click(function(){ console.log($(this)); activatesection("yellow"); });
the first click function works fine can sure jquery installed , syntax correct. whenever try put specific class or id in element selector, nothing happens.
it turns out having z-index of clickable elements < 0, meaning covered <body>
, <html>
elements.
i've since made z-indexes positive , working.
Comments
Post a Comment