Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5.     <meta charset="utf-8" />
  6.     <meta http-equiv="X-UA-Compatible"
  7.           content="IE=edge">
  8.     <title>Page Title</title>
  9.     <meta name="viewport"
  10.           content="width=device-width, initial-scale=1">
  11.  
  12.     <script src="main.js"></script>
  13. </head>
  14.  
  15. <body>
  16.  
  17.     <button id="name">Click me</button>
  18.  
  19.     <script>
  20.  
  21.         let myButton = document.getElementById('name')
  22.  
  23.         class Test {
  24.             constructor() {
  25.                 this.userSelection = 'none';
  26.             }
  27.  
  28.             assignValue(selection) {
  29.                 this.userSelection = selection;
  30.             }
  31.  
  32.             selectCharacter() {
  33.  
  34.             }
  35.         }
  36.  
  37.         let myTest = new Test
  38.  
  39.         myButton.addEventListener("click", () => {
  40.             myTest.assignValue(myButton)
  41.             console.log('in')
  42.             console.log(myTest.userSelection)
  43.         })
  44.  
  45.     </script>
  46. </body>
  47.  
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement