title: Having trouble getting a click event to run in aframe
body: <p>I am trying to write an inventory system for a game using the AFrame library. I have a custom component that is set up to set the item i'm picking up to invisible and turn the in hand item visible. However when ever it runs it won't work.</p>
  
  <p>Currently, i have a click eventlistener set up check when clicked. When clicked it is set to set the target item invisible (el) and the object in hand visible (handObj). It appears as tho the click function isn't evening running as I have a console.log set up to just check if the function ran or not.</p>
  
  <p>Edit: I created a glitch with an example project
  <a href="https://glitch.com/~tundra-ironclad" rel="nofollow noreferrer">https://glitch.com/~tundra-ironclad</a></p>
  
  <pre class="lang-js prettyprint-override"><code>var hands = [null, null];
  
  AFRAME.registerComponent('pickUp', {
      schema: {
          handObj: {type: 'selector', default: ''},
          id: {type: 'string', default: ''}
      },
  
      init: function() {
          var el = this.el;
          var data = this.data;   
  
          el.addEventListener('click', function() {
              //pickup="target= #right
              console.log("hello");
  
              if(hands[0] == null) hands[0] = data.id;
              else if (hands[1] == null) hands[1] = data.id;
              else break; 
  
              el.setAttribute('visible', 'false');
              data.handObj.setAttribute('visible', 'true');
  
          });
      }
  });
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code> &lt;a-box id="left1"
       color="#AA0000" class="clickable"
       position="8.000 0.200 7" depth = ".25"  height = ".25" width = ".25"
  
       event-set__enter="_event: mouseenter; material.color: #FF0000"
       event-set__leave="_event: mouseleave; material.color: #AA0000"
  
       pickUp="handObj: #left2; id: left"
      &gt;
  </code></pre>
  
  <p>I don't understand why the click function isn't working at all since i have copied the formatting from tutorials and those components work fine.</p>