skip to Main Content

Html – Why doesn't document.getElementById work within a function

`Why does it work outside the function tho? What's wrong? I dont get it... Tried adding return statemnts - still nothing. [[enter image description here](https://phpout.com/wp-content/uploads/2023/09/ZWAvj.png)](https://phpout.com/wp-content/uploads/2023/09/HteFI.png) DOESN'T WORK: function changeValue() { let charge = document.getElementById("myRange").value; document.getElementById("displayValue").innerHTML = charge; } WORKS: let…

VIEW QUESTION
Back To Top
Search