title: How to use addEventListener
body: <p>I was making a script that creates div elements each time a button is pressed. Originally I had the function called inline with the <code>onclick</code> attribute, but jslint doesn't like that so I moved it out and instead tried to use <code>addEventListener("click",function());</code></p>
  
  <p>I've never used <code>addEventListener()</code> before so I'm not even sure I am using it correctly.</p>
  
  <p>The problem is that it creates one <code>div</code> when the page loads and won't do anything when the button is pressed.</p>
  
  <p>Thank you in advance.</p>
  
  <p>here is what I have:</p>
  
  <pre><code>&lt;body&gt;
  &lt;form&gt;
      &lt;textarea id="a"&gt;&lt;/textarea&gt;    
      &lt;br&gt;
      &lt;input value="button" type="button"&gt;
  &lt;/form&gt;
  &lt;div id="content"&gt;
  &lt;/div&gt;
  &lt;script&gt;
      /*jslint browser:true */
      function createEntry(text) {
          "use strict";
  
          var div = document.createElement("div");
          div.setAttribute("class", "test");
          document.getElementById("content").appendChild(div);
      }
      var input = document.getElementsByTagName("input")[0];
      input.addEventListener("click", createEntry(document.getElementById('a').value));
  &lt;/script&gt;
  </code></pre>
  
  <p></p>