daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <script>
  9.         document.addEventListener("DOMContentLoaded", () => {
  10.             const buttons = document.querySelectorAll("button");
  11.             for (const button of buttons) {
  12.                 button.addEventListener("click", () => {
  13.                     document.querySelector("h1").style = `color: ${button.innerText.toLowerCase()}`;
  14.                 })
  15.             }
  16.         });
  17.     </script>
  18.     <title>Colors</title>
  19. </head>
  20.  
  21. <body>
  22.     <h1>Change Me!</h1>
  23.     <button>Red</button>
  24.     <button>Blue</button>
  25.     <button>Green</button>
  26. </body>
  27.  
  28. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top