+ 2
document.getElementById("demo") ; what is demo in this case???
3 Respuestas
+ 6
The getElementById method gets an HTML element from your document with the specified ID, in this case "demo" in order to modify or apply style to it for instance.
Example:
<p id="demo">Some text.</p>
<script> document.getElementById("demo").innerHTML = "New text.";
</script>
In this case, we want to change text for a paragraph with an ID "demo" (using .innerHTML).
0
Demo links the javascript to the paragraph... it's just like class linking in css
0
Demo is the name of an element id within your script for example <div id ="demo">
So your script is saying find the element called demo within your HTML page and then the following bit of script will be some kind of instruction or command saying what you would like to do with the element