Im getting an error when I use getelementbyId method in js. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Im getting an error when I use getelementbyId method in js.

I have put the code in public, please help. it is named as get.js

12th Feb 2017, 5:46 PM
Surya Poojary
Surya Poojary - avatar
6 Answers
+ 15
window.onload = function() { var blue = "Blue"; var re = document.getElementById("red"); re.textContent = blue; };
12th Feb 2017, 5:50 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 14
@Surya Yep! ^_^
12th Feb 2017, 5:57 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 13
You tried to grab an element before the page fully-loads...
12th Feb 2017, 5:50 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 13
I don't use emails ~_~...... do you have Discord? Join out team : https://discord.gg/TrBtd4M
12th Feb 2017, 6:06 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
thanks a ton , Val.. can I call you that? :) (it's too long)
12th Feb 2017, 5:54 PM
Surya Poojary
Surya Poojary - avatar
0
hi Val .. since you are a coder.. I'm also learning to code.. you can connect with me on suryapjr@gmail.com.. :)
12th Feb 2017, 6:00 PM
Surya Poojary
Surya Poojary - avatar