title: Get information of element that called function with jQuery
body: <p>I was wondering how I'd go about finding with jQuery, the element id that called an onClick method? my code is:</p>
  <h3>JS</h3>
  <pre><code>function getInfo(event)
  {
      console.log(event.target.id + &quot; ... &quot;);
  }
  </code></pre>
  <h3>HTML</h3>
  <pre><code>&lt;div class=&quot;menu-content&quot; id=&quot;thisismyid&quot;&gt;
      This is some placeholder text.&lt;br&gt;
      &lt;a onClick=&quot;getInfo()&quot; id=&quot;thisisthelinksid&quot;&gt;Click on me&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;div class=&quot;menu-content&quot; id=&quot;thisismysecondid&quot;&gt;
      This is some more placeholder text.&lt;br&gt;
      &lt;a onClick=&quot;getInfo()&quot; id=&quot;thisistheotherlinksid&quot;&gt;Click on me&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I can't put anything inside the parentheses of the function, because I want a function passed to it later, I just want to be able to tell which called this function.</p>
  <p>I know this has been asked many times, and a lot of the questions have answers, but I have read through a lot of them and none have helped me.</p>
  <p>Thanks guys</p>
  <h3>-EDIT-</h3>
  <p>In regards to the answers below at time of this edit, I cannot use the jQuery method like:</p>
  <pre><code>$(&quot;div.menu-content a&quot;).click(function() {
      some content here..
  });
  </code></pre>
  <p>because I need it to only be run on certain links being clicked, not all of them. Does that help clarify?</p>