title: jQuery(this).attr('id') returns undefined
body: <p>I am trying to get value / id from anchor tag when clicked. Code seems fine to me but I don't know where is problem; it returns <em>undefined</em> or <em>nothing</em> each time. </p>
  
  <p>Also tried <code>jQuery(this).attr("value");</code>, <code>jQuery(this).val();</code> and <code>jQuery(this).attr("id")</code></p>
  
  <p>Code which I have tried is following:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;ul class="switch"&gt;
          &lt;li value="1"&gt;&lt;a href="#" value="1" id="1"&gt;link 1&lt;/a&gt;&lt;/li&gt;
          &lt;li value="2"&gt;&lt;a href="#" value="2" id="2"&gt;link 2&lt;/a&gt;&lt;/li&gt;
          &lt;li value="3"&gt;&lt;a href="#" value="3" id="3"&gt;link 3&lt;/a&gt;&lt;/li&gt;
          &lt;li value="4"&gt;&lt;a href="#" value="4" id="4"&gt;link 4&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
      &lt;div class="clickedId"&gt;&lt;/div&gt;
  
      &lt;script&gt;
          jQuery(document).ready(function() {
              jQuery('ul.switch').click('a', function(evt) {
                  evt.preventDefault();
  
                  var id = jQuery(this).attr("value");
  
                  jQuery('.clickedId').append(id+'&lt;br&gt;');
              });
          });
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>