<html> <body> <button id='alert-button'>Click me!</button> <script> // We use the `id` property of the button to access it from JS const button = document.getElementById('alert-button') button.addEventListener('click', () => { // You could put any other code you wanted here // and it would run each time the button is clicked alert('Button was clicked') }) </script> </body> </html>