title: Javascript .on event handler
body: <p>I have the following scenario;  in my js I have a dynamic hyperlink that I need to capture the clicked link id.</p>
  
  <pre><code>for (var i = 0; i &lt; neighbor.data[3].length; i++){
      &lt;a class="Chris" name="a" id="+i+" href="Chris"&gt;Hi&lt;/a&gt;
  }
  </code></pre>
  
  <p>Now I can get this with;</p>
  
  <pre><code>    parseInt($(this).attr("ID"));
  </code></pre>
  
  <p>I am using this to capture the it;</p>
  
  <pre><code>$(document).on("click", "a.a", function(event) {
      event.stopPropagation();
      alert(clickedID);
      clickedID = parseInt($(this).attr("ID"));
  });
  </code></pre>
  
  <p>Now, my problem is that everytime I click on the hyperlink instead of only one clickedID I have one for every hyperlink clicked. Is there a way to prevent this?</p>