Coding

JavaScript can “Display Data” Using innerHTML – JavaScript Tutorial

Task

JavaScript can “Display Data” Using innerHTML

Description

To access the HTML element, JavaScript use the document

.getElementById(demo)

method.
The id attribute ‘demo’ defines the HTML element. The innerHTML property defines the HTML content:

Example

<p id="demo"></p>
 
<script>
document.getElementById("demo").innerHTML = 5 + 6;
</script>
Try It Yourself - Online Compliler >>