+ 1

please help document.getElementById is not a function

var x = "my text"; // when I use html Dom in js by using document.getElementById I return a error document.getElementById is not a function what to do var el = document.getElementByld('my html element id') el.textContent = b; https://code.sololearn.com/W3NlKjPVUT4d/?ref=app

9th Oct 2018, 3:53 PM
th35kyb0y
th35kyb0y - avatar
5 Réponses
+ 3
Th35kyb0y, You typed Ld instead of Id, Have A look at the changes. Hope it helps👍 https://code.sololearn.com/Wib1mqA0gqv2/?ref=app Use innerHTML instead of textContent, Or also possible to use innerText.
9th Oct 2018, 5:12 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 5
it's Id (Uppercase i)
9th Oct 2018, 4:17 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
window.onload = function(){ var b = "my some text"; var el = document.getElementById("myid"); el.textContent=b; }
9th Oct 2018, 4:54 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 3
Th35kyb0y, Glad I could help👍
9th Oct 2018, 5:23 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 1
Thank you bro... I realize my mistake LD and I looks same... Thats the reason why am stuck on a simple thing btw thank you so much...
9th Oct 2018, 5:20 PM
th35kyb0y
th35kyb0y - avatar