+ 2
Placing a div in a random position on a website.
Hey, everyone! The code I'm currently working on has a long way to go, and is far from ANY game whatsoever. So, long story short: I'm trying to place a div(the little green ball) to a random position, and I'm getting all sorts of "Uncaught Type of null" errors and such. I'm looking for a way to do this with pure JavaScript (no jQuery). Please, help! https://code.sololearn.com/WlniPeYGJo0M/?ref=app
3 Respuestas
+ 4
You are selecting food class by
document.querySelector("food")
Corrected :
document.querySelector(".food")
+ 3
Use dot (.) for class selectors
Line 13 should be document.querySelector(".food")
+ 3
Oops... :D Forgot about that part. Thanks you! ^_^