Can someone explain what the document.getElementById(\"demo\") line does in the example below?
document.getElementById(\"demo\")
I understand getElementById gets the id of demo but the id is
getElementById returns a reference to the element using its id. The element is the input in the first case and the paragraph in the second case.
getElementById
id
input
https://developer.mozilla.org/en-US/docs/Web/API/document.getElementById