Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 10
JS Animation Question
Hey everybody, I'm working on a game in Code Playground. I can't tell you much yet, but I had a question. You the simple box animation Sololearn taught at the end of their JS course? Is there a way to get an animation to only play if a button is clicked? Please answer in the comments below. Thanks ahead of time!
3 Answers
+ 10
I'll give it a try @Mejer Jebali
+ 9
@Mejer it just says that the function isn't defined.
+ 3
Put your animation inside a js funtion "myFunction"
Then call it with onclick event on html
<button onclick="myFunction()">Click me</button>