JavaScript Events
<!DOCTYPE html> <html> <body> <button id="save">Save</button> <script> const button = document.querySelector("#save"); button.addEventListener("click", function () { console.log("Saved!"); }); // Arrow functions work too button.addEventListener("click", () => { button.textContent = "Done"; }); </script> </body> </html>