0

I can't figure out how to use the getElementById code in JavaScript Code Playground, I've tried multiple times and watched YT

I tried multiple times even watching videos and I still wasn't getting through it was only errors, I tried everything also, I saved and came back, no luck, I copied and pasted from a Sololearn lesson, and still no luck, I don't know if it is a 2025 bug which makes no sense and I haven't reached far in Javascript so I don't know any other codes so please if someone wants to explain or give me and example with comments or basic introduction to Javascript example I would gladly appreciate it.

19th Jun 2025, 1:37 PM
Rondell Nagassar
Rondell Nagassar - avatar
6 Réponses
0
Rondell Nagassar Check if you're doing it this way: https://sololearn.com/compiler-playground/WUz55HD6X4AQ/?ref=app EDIT: Lisa mentioned a great point I didn't. The code in JS tab of code playground runs before/parallel with the HTML code.
19th Jun 2025, 2:44 PM
Afnan Irtesum Chowdhury
Afnan Irtesum Chowdhury - avatar
+ 3
Show your code. You can only access the HTML element with Javascript when the body is fully loaded. Wrap your Javascript in window.onload = () => { ... }
19th Jun 2025, 3:35 PM
Lisa
Lisa - avatar
+ 1
Rondell Nagassar My code used internal JS which would work fine. Still, updated the code with seperate JS!
19th Jun 2025, 3:56 PM
Afnan Irtesum Chowdhury
Afnan Irtesum Chowdhury - avatar
0
Lisa, Okay I'll post a code with it just now
19th Jun 2025, 3:54 PM
Rondell Nagassar
Rondell Nagassar - avatar
0
Afnan Irtesum Chowdhury, I'll try this just now, but can you make the JavaScript update the words in the example please?
19th Jun 2025, 3:55 PM
Rondell Nagassar
Rondell Nagassar - avatar
0
Okay, guys, I got it just now, I looked at the codes and noticed that I was using extra brackets() where it wasn't needed, Thank you both for your time I do appreciate it! Afnan Irtesum Chowdhury and Lisa.
19th Jun 2025, 4:06 PM
Rondell Nagassar
Rondell Nagassar - avatar