Ask coding questions

← Back to all posts
Javascript is not working
lolguineapig (26)

I am trying to make a SIMON game, but my JS is not working. I tried using a JS file, but that did not work. So then I tried using the <script> tag in my HTML... and that did not work either. Here is my code:

<script src=""></script>
<h1 class="simonStatus">Press any key to start!</h1>
<div id="simongrid">
<button class="green">&nbsp;</button>
<script type="text/javascript">
var greenWidth = $('.green').width();
$('.green').css({'height', greenWidth + 'px'});


Answered by ch1ck3n (2340) [earned 5 cycles]
View Answer
ch1ck3n (2340)

line 10 should be $('.green').css('height', greenWidth + 'px');

lolguineapig (26)

@ch1ck3n Thanks so much :) the strange part was that when I did $('.green').css({'height', greenWidth + 'px'}) none of my javascript worked.