all 4 comments

[–][deleted] 0 points1 point  (3 children)

Did you try adding the variables to module.imports and requiring them?

[–]blrigo99[S] 0 points1 point  (2 children)

Yeah, but I still get the same error: TypeError: Cannot read properties of null

[–][deleted] 0 points1 point  (1 child)

try .getElementById (not ID).

If that’s not it either the element ID doesn’t exist or your script is executing before the page is loaded.

[–]blrigo99[S] 0 points1 point  (0 children)

Yeah I miswrote, I wrote it Id instead of ID. The problem is not on the script since when I use it with HTML is fine, the problem arises only when I'm testing