title: Bind unique click event to each item in repeater (ajax/jquery)
body: <p>ok so I have this repeater:</p>
  
  <pre><code>        &lt;asp:Repeater runat="server" ID="rep"  &gt;
          &lt;ItemTemplate&gt; 
          &lt;tr&gt;
          &lt;td&gt;           
          &lt;div id="resultDiv"&gt;
          click me
          &lt;/div&gt;                      
          &lt;/td&gt;
          &lt;/tr&gt;            
          &lt;/ItemTemplate&gt;
          &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>and i have this jquery ajax call:</p>
  
  <pre><code>  $(document).ready(function () {
              $("#resultDiv").click(function () {
                  $.ajax({
                      type: "POST",
                      url: "Page.aspx/GetDate",
                      data: "{}",
                      contentType: "application/json; charset=utf-8",
                      dataType: "json",
                      success: function (msg) {
                          // Replace the div's content with the page method's return.
                          $("#resultDiv").text(msg.d);
                      }
                  });
              });
          });
  </code></pre>
  
  <p>the problem is that this only works for the first div inside the repeater. If i click any other divs, the click event isn't being fired. 
  I know this is because they all have the same id, being "resultDiv".</p>
  
  <p>I am now looking for a way of giving them unique ID's, which is something I can do like this: (inside the repeater itemtemplate)</p>
  
  <pre><code> &lt;td&gt;          
  &lt;div id="resultDiv_&lt;%#Eval("divId") %&gt;"&gt;
   click me
   &lt;/div&gt;        
  </code></pre>
  
  <p>This gives all the divs inside the repeater a unique ID, but this way the ajax click event doesnt fire anymore because </p>
  
  <pre><code> $("#resultDiv").click(function () {
  </code></pre>
  
  <p><code>resultDiv</code> is now something like <code>resultDiv_1</code> or <code>resultDiv_2</code>.</p>
  
  <p>so im looking for something to bind a click event to each div inside the repeater. I tried doing it like this in the ajax call:</p>
  
  <pre><code>$("#&lt;%#Eval("divId") %&gt;").click(function () 
  </code></pre>
  
  <p>but this doesn't work and gives me all kinds of errors.</p>
  
  <p>Is there any way i can do this ? Please not that I do not want to use updatepanels.</p>