title: jQuery .each() to add event handler
body: <p>I'm having an issue with the .each() function in jQuery, I'm calling these lines when I successfully getAjax and store it in the data variable:</p>
  
  <pre><code>$.each(data, function() {
  $('#modulesList').append("&lt;p&gt;&lt;a href='#'&gt;" + this.code + "&lt;/a&gt;&lt;/p&gt;")
    .click(function(){
      alert($(this));
     });
  });
  </code></pre>
  
  <p>The problem is, Once I click on one of my a elements(Which all look fine and have the correct text) I get the alert popping up 5 times for each of them. Iterating from the 0 to 5 objects in the JSON.</p>
  
  <p>Anybody know why?</p>
  
  <p>Thanks!</p>