title: JQuery click() won't apply to anchor tag?
body: <p>I am creating some thumbnails dynamically with JQuery, like this (in a loop):</p>
  
  <pre><code>var thumb = $('&lt;a class="tinythumb"&gt;&lt;/a&gt;');
  thumb.append('&lt;img src="' + productThumbnailList[i] + '" width="70" height="70" /&gt;');
  thumbContainer.append(thumb);
  </code></pre>
  
  <p>Now I'm trying to add some functionality to these via JQuery's <code>.click()</code>, but I just can't get it working. I've never had trouble trying to do this before, there are no errors and there's nothing that I can see from my point of view that is incorrect.</p>
  
  <p>I tried this simple <code>.each()</code> to see what would happen. Funnily enough, the <code>rel</code> attribute <strong>is</strong> being updated, but there's still no <code>.click()</code> functionality (alert never performed).</p>
  
  <pre><code>$("div#thumbcontainer a").each(function()
  {
      $(this).attr("rel", "works");
      $(this).click(function()
      {
          alert('never called');
  
      });
  });
  </code></pre>
  
  <p>This is the page I'm trying to work with:</p>
  
  <p><a href="http://burwell.businesscatalyst.com/catalogue/containmentscreen/Enviroguard#" rel="nofollow">http://burwell.businesscatalyst.com/catalogue/containmentscreen/Enviroguard#</a></p>
  
  <hr>
  
  <p>Here's the entire JavaScript which probably has something relevant in it that's missing above:</p>
  
  <pre><code>// Properties
  var thumbContainer = $("div#thumbcontainer");
  var str = thumbContainer.html();
  var productThumbnailList = str.split(';');
  
  // Clear thumbContainer of junk HTML
  thumbContainer.html("");
  
  
  // Create thumbnails
  if(productThumbnailList.length &gt; 1)
  {
      for(var i = 0; i&lt;productThumbnailList.length; i++)
      {
          var large = Math.round(i/2) * 2 == i ? false : true;
  
          // create thumbnail
          if(!large)
          {
              var thumb = $('&lt;a class="tinythumb"&gt;&lt;/a&gt;');
              thumb.append('&lt;img src="' + productThumbnailList[i] + '" width="70" height="70" /&gt;');
              thumbContainer.append(thumb);
          }
      }
  
      $("div#thumbcontainer a").each(function()
      {
          $(this).attr("rel", "works");
          $(this).click(function()
          {
              alert('never called');
  
          });
  
      });
  }
  </code></pre>
  
  <hr>
  
  <p>Adding an <code>onclick="someFunc()"</code> parameter to the <code>&lt;a&gt;</code> tag makes it call the function fine..</p>