title: How set ID and use it dynamically in mvc 4 razor?
body: <p>I have html elements in <code>foreach</code>. I cannot declare ID name to those manually.
  I used  <code>id='ProductSelect_@(item.Id)'</code> to set Id:</p>
  
  <pre><code>  foreach (var item in Model)
     {
       &lt;a href="#" id='ProductSelect_@(item.Id)' class="select-link"&gt;Select this&lt;/a&gt;
     }
  </code></pre>
  
  <p>But, now I need <strong>.click()</strong> function for eash <code>&lt;a&gt;</code> link to do my some operations. How write click function for dynamic ID's?<br>
  I checked this, but it does not work :</p>
  
  <pre><code>$("#ProductSelect_@(item.Id)").click(function () {
  
     //any operation
  
   });
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function () {
          $('.select-link').click(function() {
              var id = $(this).attr('data-id');
  
              url = '@Url.Action("SelectThis", "Product")';
              var data = { id: '@Model.Id' };
              $.post(url, data, function (result) {
                  if (result.success) {
                      alert("Thanks");
                  }
                  else {
                      alert("Problem occured...");
                  }
              });
  
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>This click() functions send request to controller iteration counts times. What is wrong in my code?</p>