title: Rebuild jQuery native functions to HTMLElements in Javascript
body: <p>I want to reimplement the jQuery functions.</p>
  <p>For example <a href="https://api.jquery.com/attr/" rel="nofollow noreferrer">.attr()</a>.</p>
  <p>I found some threads like <a href="https://stackoverflow.com/questions/4670361/how-to-add-my-own-methods-to-htmlelement-object">this</a>.</p>
  <p>So I tried something like:</p>
  <pre class="lang-js prettyprint-override"><code>HTMLElement.prototype.attr = (pAttributeName, pAttributeValue) =&gt; {
    if(pAttributeValue){
      this.setAttribute(pAttributeName, pAttributeValue);
    } else {
        return this.getAttribute(pAttributeName);
    }
  };
  </code></pre>
  <p><strong>But it don't work. Do I have to init the Elements first, in a constructor?</strong></p>