title: how to get the value of the clicked table row?
body: <p>My question is: how do I get the value of the clicked row and column?</p>
  
  <p>The code I have is this: </p>
  
  <p>JS:</p>
  
  <pre><code>$.ajax({
          type: 'POST',
          url: url,
          data: json,
          success: function(data) {
              var response_array = JSON.parse(data);
              var columns = ['id', 'name', 'email', 'telephone', 'website', 'city'];
              var table_html = ' &lt;tr&gt;\n' +
                  '&lt;th id="id"&gt;Id&lt;/th&gt;\n' +
                  '&lt;th id="name"&gt;Bedrijfnaam&lt;/th&gt;\n' +
                  '&lt;th id="email"&gt;E-mail&lt;/th&gt;\n' +
                  '&lt;th id="telephone"&gt;Telefoon&lt;/th&gt;\n' +
                  '&lt;th id="website"&gt;Website&lt;/th&gt;\n' +
                  '&lt;th id="city"&gt;Plaats&lt;/th&gt;\n' +
                  '&lt;/tr&gt;';
              for (var i = 0; i &lt; response_array.length; i++) {
                  //create html table row
                  table_html += '&lt;tr&gt;';
                  for (var j = 0; j &lt; columns.length; j++) {
                      //create html table cell, add class to cells to identify columns
                      table_html += '&lt;td class="' + columns[j] + '" &gt;' + response_array[i][columns[j]] + '&lt;/td&gt;'
                  }
                  table_html += '&lt;/tr&gt;'
              };
              $("#posts").append(table_html);
          },
          error: function (jqXHR, textStatus, errorThrown) { alert('ERROR: ' + errorThrown); }
      });
  </code></pre>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;div class="tabel"&gt;
       &lt;table id="posts"&gt;
       &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code> $('#posts').click(function(){
          console.log("clicked");
          var id = $("tr").find(".id").html();
          console.log(id);
  });
  </code></pre>
  
  <p>Sadly this will only give me the id of the first row, no matter where I click.</p>
  
  <p>Any help is appreciated!</p>
  
  <p>Ramon</p>