title: Get the text of the clicked link using javascript/jquery
body: <p>How do I get the value of the clicked link?</p>
  
  <p>This is my html:</p>
  
  <pre><code>&lt;div id="results"&gt;
     &lt;ul&gt;
         &lt;li&gt;
            &lt;a href=""&gt;1&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;a href=""&gt;2&lt;/a&gt;
        &lt;/li&gt;
     &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is how I attempted to get the value:</p>
  
  <pre><code>$('#results').on('click', 'a', function (){
     var text = $(this).innerHTML;
  });
  </code></pre>
  
  <p>What am I missing? Is there a better way to do this?</p>
  
  <p>Thanks in advance :)</p>