Use of document.getElementById in JavaScript

后端 未结 7 1008
后悔当初
后悔当初 2021-02-06 08:31

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

7条回答
  •  长情又很酷
    2021-02-06 09:14

    document.getElementById("demo").innerHTML = voteable finds the element with the id demo and then places the voteable value into it; either too young or old enough.

    So effectively

    becomes for example

    Old Enough

提交回复
热议问题