Use of document.getElementById in JavaScript

后端 未结 7 1013
后悔当初
后悔当初 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: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

    <p id="demo">
    

    or

    <div id="demo"> 
    

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

    0 讨论(0)
提交回复
热议问题