title: Click listener won't work from generated html with jsondata
body: <p>have trouble with getting the value obtaining click listener from an element.<br>
  When i click on "tagit" it will happen nothing and dont know why!!  </p>
  
  <p>I have this code in my javascript:  </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function UpdateBuddyStat()
  {
      $.getJSON('/update-buddies', function(jsonData){
  
       var counterjson = 0;
       var LI_list_html = '';
  
       $.each(jsonData, function(i,value){
  
        var count = counterjson++;
        var username = jsonData[i].name;
        var buddy = jsonData[i].buddyid;
  
        var DIV_html = username+' &lt;div class="FunctionBuddyBox"&gt;&lt;span class="TagBuddy" id="TagsBuddy_'+buddy+'" data-tagbuddyid="'+buddy+'"&gt;tagit&lt;/span&gt;&lt;/div&gt;';
  
        LI_list_html = LI_list_html+'&lt;li&gt;'+DIV_html+'&lt;/li&gt;';
       });
  
       $("#ShowBuddyList ul li").remove();
       $("#ShowBuddyList ul").html(LI_list_html);  
      })
  }
  setInterval("UpdateBuddyStat()", 3000);
  &lt;/script&gt;
  </code></pre>
  
  <p>And this is how i catch the listener:  </p>
  
  <pre><code>$('[id^=TagsBuddy_]').click(function(){
      var buddyid = $(this).data('tagbuddyid');
      alert(buddyid);         
  });  
  </code></pre>
  
  <p>By this code bellow (static html) it will works fine:  </p>
  
  <pre><code>&lt;?php echo $value['name'] ?&gt; &lt;div class="FunctionBuddyBox"&gt;
  &lt;span class="TagBuddy" id="TagsBuddy_&lt;?php echo $value['fb_id'] ?&gt;" data-tagbuddyid="&lt;?php echo $value['fb_id'] ?&gt;"&gt;tagit&lt;/span&gt;
  &lt;/div&gt;  
  </code></pre>
  
  <p>Dont have any idea why! Any suggestion? Thanks a lot.</p>