title: How to get the id of an anchor tag in jQuery?
body: <p>How to get the id of an anchor tag in jQuery?
  This is the tag.</p>
  
  <pre><code> &lt;ul class="formfield"&gt;
       &lt;li class="selected"&gt;&lt;a href="" id="text"&gt;Text&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href="" id="textarea"&gt;Textarea&lt;/a&gt;&lt;/li&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>I need to get the id, i.e., textarea,text etc in a variable.</p>
  
  <p>I tried something like this,but there is no such thing as fieldValue I suppose.</p>
  
  <pre><code>$('.formfield a').click(function() {         
      fieldType=$('.formfield a').fieldValue();
      alert(fieldType);
  });
  </code></pre>