Files
JavaScript-from-Beginner-to…/Chapter 09/Code Samples/ch9-new-element.html
T
brightboost 67a8d8a7a0 reorganizing
2021-12-02 21:21:10 +01:00

12 lines
305 B
HTML
Executable File

<html>
<body>
<script>
function addRandomNumber(){
let el = document.createElement("p");
el.innerText = Math.floor(Math.random() * 100);
document.body.appendChild(el);
}
</script>
<button onclick="addRandomNumber()">Add a number</button>
</body>
</html>