Advertisement
AviEzerzer

Untitled

May 14th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.69 KB | None | 0 0
  1.   <input type="text" id="display" disabled>
  2.   <div class="keyboard">
  3.     <button id="Q">Q</button>
  4.     <button id="W">W</button>
  5.     <button id="E">E</button>
  6.     <button id="R">R</button>
  7.     <button id="T">T</button>
  8.     <button id="Y">Y</button>
  9.   </div>
  10.   <script>
  11.     var display = document.getElementById('display');
  12.     console.log("TCL: display", display)
  13.     var buttons = document.getElementsByClassName('keyboard')[0].children;
  14.     console.log("TCL: buttons", buttons)
  15.     for (let button of buttons) {
  16.       button.addEventListener('click', function (e) {
  17.         console.log("TCL: this", this.innerText)
  18.         display.value += this.innerText;
  19.       });
  20.     }
  21.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement