I want to reimplement the jQuery functions.
For example .attr().
I found some threads like this.
So I tried something like:
HTMLElement.prototype.attr = (pAttributeName, pAttributeValue) => {
if(pAttributeValue){
this.setAttribute(pAttributeName, pAttributeValue);
} else {
return this.getAttribute(pAttributeName);
}
};
But it don't work. Do I have to init the Elements first, in a constructor?