Files
JavaScript-from-Beginner-to…/chapter9/ch9-new-element.html
T
2021-09-04 21:22:51 +02: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>