Hi,
On my Simon project I am trying to make as much code reuse as I can-- Thus have a single ‘play sound’ function for both when the ‘user’ presses a button as when the computer ‘chooses’ one.
I am trying to use the JQuery .trigger(“click”) event to do this and it… ‘Sort-of’ works…
The code thus far is on start up the program will randomly choose a button to press and then trigger it as just described. The part that does ‘work’ is that it plays the sound associated with that button. The button it selected is also output to the console.
However, if then one goes and manually clicks one of the buttons (even the one chosen) you can see I have an ‘active’ CSS property attached to the image that is supposed to make the button ‘light up’.
So, in a sense it really ‘is’ clicking the button, in a sense because it triggers the sound-- But when the computer selects the button doesn’t ‘light-up’. Thus is a .trigger(“click”) somehow at once a click event, but not one ?