+ 1

Javascript

let countEl = document.getElementById("count-el"); console.log(countEl); let count = 0; function increment(){ count = count + 1; countEl.innerText = count; console.log(countEl.innnerText); } increment(); What's wrong here?

21st Jan 2025, 4:47 PM
Mariam Abdelrahman
Mariam Abdelrahman - avatar
2 ответов
+ 3
What error do you get? Describe it precisely. Check the spelling of innerText. Note that Javascript will only find the HTML element if it is already loaded in DOM.
21st Jan 2025, 5:35 PM
Lisa
Lisa - avatar
0
the word "innnerText" is spelled wrong it's "innerText".
22nd Jan 2025, 9:22 AM
Joseph
Joseph - avatar