Trying to get a custom div to follow the cursor. Gives me error "cursorDot.style is undefined"
Here's the code I used in my javascript file:
and the HTML and CSS:
error in console:
"cursorDot.style is undefined"
2 Replies
The result of querySelectorAll() is not an element. It is a node list. If there is only one member of the cursor-dot class. Use querySelector(). This approach also works if there are multiple members of the class but you only want to select the first one. If there are multiple members of the class and you want to operate on all of them, you must iterate through the node list and apply the operation on each individually.
It worked. thank you.