Help with simon game

Help with simon game
0

#1

Hi, I’m currently working on the Simon game, but am having trouble calling a function within a click event. I’m not very far with this code yet so bear with me. I’ve been looking up stuff on google about calling functions within click functions, but can’t find exactly what I’m looking for.
Here’s the link to my code:

I was just hoping someone could tell me why the function random_color() won’t work when I click the start button…I know it’s something simple that I’m just missing…

Thanks in advance!


#2

There doesn’t seem to be an animate method that you can chain after document.getElementById(). Maybe you meant $(color).animate()?

Edit. You might also need to prepend a # before color: $('#' + color).animate()


#3

Thanks @kevcomedia!! That did the trick…One thing I don’t understand is that my code initially was document.getElementById(color).animate({opacity:1},100)…I’m just a little confused why that wouldn’t work? Can I not have the animate method with the document.getElementById?