0

Why can't I make my image interactive?

I'm making a cookie clicker game for a grand review for HTML, CSS, and JS, but when I put: "onclick='click()'", It wouldn't execute the function I created, I tried using a span, but it didn't work either, can someone help me out here? I thought JS made everything interactive.

12th Oct 2024, 3:35 PM
StarCodes (EDUCATION)
2 odpowiedzi
+ 2
Your span is tiny, so it's useless as a hitbox. I reassigned the id and onclick to the cookie image instead. https://sololearn.com/compiler-playground/WP7iOjI5vQVP/?ref=app
12th Oct 2024, 4:04 PM
Bob_Li
Bob_Li - avatar
+ 1
link your code
12th Oct 2024, 3:38 PM
Lisa
Lisa - avatar