title: How do I find the ID of an element that was clicked?
body: <p>Say I have an many html elements, a row in a table composed of table data (<code>&lt;td&gt;</code>) tags.</p>
  
  <pre><code>&lt;td id="data1"&gt;foo&lt;/td&gt;
  &lt;td id="data2"&gt;bar&lt;/td&gt;
  &lt;td id="data3"&gt;baz&lt;/td&gt;
  </code></pre>
  
  <p>How would I return the <code>id</code> of the <code>td</code> that was clicked. I know that I should make them links so that I can click on them properly, but just for this case I don't want to put links.</p>
  
  <pre><code>$("td").click(function () {
    id = //The ID finder goes here
    clickFunction(id)
   }
  </code></pre>
  
  <p>I was thinking this is how it would be formatted. JQuery would attach an onclick event listener to any table data tags and when it fired, a function would run with the id of the table data element that was clicked.</p>