+ 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
5 Answers
+ 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.
+ 5
it's Id (Uppercase i)
+ 4
window.onload = function(){
var b = "my some text";
var el = document.getElementById("myid");
el.textContent=b;
}
+ 3
Th35kyb0y,
Glad I could helpš
+ 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...