title: elements.getAttribute is not a function
body: <p>I get this error</p>
  <p><code>elements.getAttribute is not a function</code></p>
  <p>I want to get the id value from the first div with help of the name, same with the &quot;a&quot; tag.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function intweb_form() {
    var elements = document.getElementsByName('intweb-button-send');
    var id = elements.getAttribute('id');
  
    var element = document.getElementsByName("intweb-form-mail-cd");
    var id_code = element.getAttribute('id');
    console.log(id, id_code);
  }  </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="mail" name="intweb-form-mail-cd" style="text-align: center;border-radius: 40px; box-shadow: 5px 4px 10px black; background-color: #39CCCC; height: 200px; width: 300px; margin: 0px auto;"&gt;
    &lt;p style="padding-top: 15px;font-size:20px; font-weight: bold;"&gt;Ihre E-Mail: &lt;/p&gt;
    &lt;input id="intweb-ghost-button" type="input" style="padding: 5px"&gt;&lt;/input&gt;
    &lt;a id="username" name="intweb-button-send" href="javascript:intweb_form()" class="intweb-ghost-button"&gt;
      &lt;p style="margin: 0 auto;" id="intweb-ghost-text"&gt;Senden&lt;/p&gt;
    &lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>