title: Get ID of clicked on element in function
body: <p>I want to get the ID of an element I click on.
  I put the function in the onclick element, like this:</p>
  
  <pre><code>&lt;a id="myid" class="first active" onclick="markActiveLink();" href="#home"&gt;Home&lt;/a&gt;
  </code></pre>
  
  <p>And this is in the function:</p>
  
  <pre><code>function markActiveLink() {   
      alert($(this).attr("id"));
  }
  </code></pre>
  
  <p>This doesn't work, as it says it isn't defined.
  Does it really forget about the ID, do I have to type it in the onclick?</p>