Am typing in "document.getElementByld()" but the browser keeps returning "type error: document.getElementByld()" is not a functi | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

Am typing in "document.getElementByld()" but the browser keeps returning "type error: document.getElementByld()" is not a functi

10th Nov 2018, 7:51 AM
Martin Mururu
Martin Mururu - avatar
5 Antworten
+ 2
Were you typing an L? because i and L use the same character and can be confusing. i = I L = l
11th Nov 2018, 8:52 PM
Daniel Cooper
Daniel Cooper - avatar
+ 11
Can you attach the link to code here? 😅
10th Nov 2018, 8:04 AM
$hardul B
$hardul B - avatar
+ 3
There could be a few issues here Here are possible solutions: 1. Javascript loads before the DOM, so surround whatever is being called right away with window.onload { //your code here} 2. You possibly forgot quotes in getElementById() Like this: getElementById("MyElement"); 3. You forgot the word "document". document.getElementById("MyElement") 4.You're trying to get a class with getElementById(). To grab a class, use getElementsByClassName("Example")[1] [1] represents the class. Since there can be multiple classes, you can use this to get a specific one. 5. You spelled the id wrong. Pretty sure we've all done this. 6. you forgot quotes in the HTML id deceleration. I've done this.
10th Nov 2018, 9:37 AM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Martin Mururu Did you ever get this figured out?
11th Nov 2018, 9:42 AM
Daniel Cooper
Daniel Cooper - avatar
0
all that time ive been thinking its Byld(with an "l")🤦🤦
11th Nov 2018, 12:54 PM
Martin Mururu
Martin Mururu - avatar