Can someone explain what the document.getElementById(\"demo\")
line does in the example below?
I understand getElementById gets the id of demo but the id is
You're correct in that the document.getElementById("demo")
call gets you the element by the specified ID. But you have to look at the rest of the statement to figure out what exactly the code is doing with that element:
.innerHTML=voteable;
You can see here that it's setting the innerHTML
of that element to the value of voteable
.