title: onClick does not work properly on p tag
body: <p>I want to bind a click event to every <code>&lt;p&gt;</code> but it does not seem to work properly.</p>
  
  <p>When I run the script I instantly get three alerts. I only want to get them when clicking any of the three <code>&lt;p&gt;'</code>s.</p>
  
  <p>Can anyone tell me what I'm doing wrong?</p>
  
  <p>Edit: Sry this is what it looks like.
  The HTML is just as it should: <code>&lt;p class="special"&gt;text text text&lt;/p&gt;</code> etc</p>
  
  <pre><code>(function () {
      var myFunction = function (theP) {
              alert(theP.id)          
          }
  
  
      window.onload = function () {           
          var pTags = document.getElementsByTagName('p'),
              pLength = pTags.length,
              i;
  
          for (i = 0; i &lt; pLength; i += 1) {
              if(pTags[i].className == 'special'){
  
                  pTags[i].onClick = myFunction(pTags[i]);
  
              }
          };
      }
  })();
  </code></pre>
  
  <p>Ps. I cannot use jQuery atm</p>