title: Get column data when clicked on row with Razor and JS
body: <p>I have table that is built dynamically with Razor in MVC.</p>
  
  <p>I want to be able to click on the a row and get the value of lets's say the first column ID.</p>
  
  <p>Right now it's getting all the columns but I don't know too much Javascript or how it's stored with text. </p>
  
  <p>Anyways what I'm looking for is to get a certain column on the row I clicked.</p>
  
  <p>Razor MVC</p>
  
  <pre><code>&lt;table id="myTable" class="tablesorter"&gt; 
  &lt;thead&gt; 
  &lt;tr&gt; 
      &lt;th&gt;ID&lt;/th&gt; 
      &lt;th&gt;Owner&lt;/th&gt; 
  &lt;/tr&gt; 
  &lt;/thead&gt; 
  &lt;tbody&gt; 
  @for(int i=0; i&lt;Model.changes.Count(); i++)
  {
  &lt;tr&gt; 
      &lt;td&gt;@Model.changes[i].ID&lt;/td&gt; 
      &lt;td&gt;@Model.changes[i].Owner&lt;/td&gt; 
  &lt;/tr&gt; 
  }
  &lt;/tbody&gt; 
  &lt;/table&gt; 
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script&gt;
  
      var table = $("#myTable tr");
  
      table.click(function () {
          alert($(this).text());
      });
  
  &lt;/script&gt;
  </code></pre>