Hello Readers!
In almost every web application their will be a need of javascript function "document.getElementById" , lets understand this how it work.
Say suppose We have this HTML structure
<div id="scores" style="display:none;">
<h4>Scoreboard</h4>
<ul id="scoreboard">
</ul>
</div>
We want to Show the updated Score in the ul tag of id="scoreboard" then how we will do this. Here's comes the concept of document.getElementById .
var score = document.getElementById("scoreboard")
Above code will save the HTML structure of id="scoreboard" in score variable.
Now we can easily show User's score with the help of javascript function innerhtml. Here's the Code.
var score = document.getElementById("scoreboard").innerHTML("User's Score").
Similarly we can call the HTML structure using javascript function "document.getElementByClass".
0 Comment(s)