Author: b.henry 03/18/2021
Language:
JavaScript
Tags: javascript
Here's an example of javascript using innerHTML
JavaScript can "display" data in different ways:
To access an HTML element, JavaScript can use the document.getElementById(id) method.
The id attribute defines the HTML element. The innerHTML property defines the HTML content:
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 + 6;
</script>
JavaScript Output (w3schools.com)
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<p>My First Paragraph</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 + 6;
</script>
</body>
</html>