Use of document.getElementById in JavaScript

后端 未结 7 1114
后悔当初
后悔当初 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条回答
  •  萌比男神i
    2021-02-06 09:25

    Here in your code demo is id where you want to display your result after click event has occur and just nothing.

    You can take anything

    or

    It is just node in a document where you just want to display your result.

提交回复
热议问题