Last active
September 9, 2020 17:15
-
-
Save travis23/b4d2bb3f9cbbd1667021bce0a685f608 to your computer and use it in GitHub Desktop.
[Display Javascript Variable on HTML Page] #javascript #html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- See https://stackoverflow.com/questions/40858456/how-to-display-a-javascript-var-in-html-body --> | |
<html> | |
<head> | |
<script> | |
function displayNumber(number) { | |
document.getElementById("someID").innerHTML = number.toString(); | |
} | |
</script> | |
</head> | |
<body onload="displayNumber(42)"> | |
<p><span id="headCount"></span></p> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment