<!DOCTYPE html> <html> <body>
<button onclick="myFunction()">Click me</button>
A function is triggered when the button is clicked. The function outputs some text in a p element with id="demo".
<script> function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
} </script>
</body> </html>