🚧elem.attr()
🔰 JS ⟩ DOM ⟩ Types ⟩ Element ⟩ .attr()
// ⭐️ get/set attribute
Element.prototype.attr = function(name, value){
if (value !== undefined) { this.setAttribute(name, value) };
return this.getAttribute(name) || undefined;
};
Last updated
Was this helpful?