title: Uncaught TypeError: Cannot read property 'target' of undefined
body: <p>I want to create tabs on pure js and decided to implement it through "data-attr".</p>
  
  <pre><code>var allTabs = document.querySelectorAll('.tab'); //all tabs on page
  
  var clickTabHandler = function (event) {
  
      var target = event.target;
  
      var id = target.getAttribute('data-content');
  
      alert(id);
  
  };
  
  for (var i = 0; i &lt; allTabs.length; i++) {
      allTabs[i].onclick = clickTabHandler(event);
  }
  </code></pre>
  
  <p>in the console get : Uncaught TypeError: Cannot read property 'target' of undefined;</p>
  
  <p>Why?</p>