title: How to get value of <a> tag in JavaScript
body: <p>I have this code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;BUTTON ONCLICK="stups()"&gt;VALUE FINDER &lt;/BUTTON&gt;
  &lt;a value="this is a value" href="value"&gt;&lt;img src="b5.jpg"&gt; values rule!!&lt;/a&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;
  &lt;script&gt;
  var a = document.getElementsByTagName("a").value
  function stups(){
  
  document.getElementById("demo").innerHTML=a
  
  }
  &lt;/script&gt;
  
  
  &lt;/html&gt;
  </code></pre>
  
  <p>The javascript is simply meant to get the value of th (link) when the button is clicked I don't even know what is supposed to be the value whether it is th <code>href</code> attribute, the <code>value</code> attribute ,the value of the <code>img</code> attribute or the text in between the two <code>&lt;a&gt;</code>and <code>&lt;/a&gt;</code>,well I've tried EVERYTHING i could think of and it never gives me any value it keeps giving me the word   <code>undefined</code>.Please help.</p>
  
  <blockquote>
    <p><strong>NB</strong>:I <em>need</em> that  to be in between the <code>&lt;a&gt;&lt;/a&gt;</code> because it is a link</p>
  </blockquote>
  
  <p>Thanks in advance</p>