title: jquery .on() from append
body: <p>I'm really confuse about how to add a click event to element created by jquery.</p>
  
  <p>Now, I generate elements like this:</p>
  
  <pre><code>$.ajax(
      params....
  )
  .done(function(item){
      $.each(item, function(i, some){
          a = '&lt;p&gt;some text&lt;/p&gt;';
          $(node).before(a);
      }
  });
  </code></pre>
  
  <p>my problem is when I try to add a click event to element "p". If I do:</p>
  
  <pre><code>$('p').on('click', 'p', function(){
      alert('yai!');
  });
  </code></pre>
  
  <p>Is showing nothing. BUt if I do:</p>
  
  <pre><code>$.ajax(
      params....
  )
  .done(function(item){
      $.each(item, function(i, some){
          a = '&lt;p&gt;some text&lt;/p&gt;';
          $(a).click(function(){
              alert('yai!');
          });
          $(node).before(a);
      }
  });
  </code></pre>
  
  <p>It show too many alerts (the same number of p elements)</p>
  
  <p>What I'm doing wrong?</p>