jsegd
Version:
Utilitário de ferramentas para desenvolvimento
3 lines (2 loc) • 940 B
JavaScript
function get(t,e){return(e??document).querySelector(t)}function getAll(t,e){const n=e??document;return Array.from(n.querySelectorAll(t))}function getData(t){if(!t)throw new Error("O ID do formulário é obrigatório.");const e=document.getElementById(t),n=new FormData(e),o={};return n.forEach(((t,e)=>{o[e]=t})),o}HTMLElement.prototype.setValue=function(t=""){(this instanceof HTMLInputElement||this instanceof HTMLSelectElement||this instanceof HTMLTextAreaElement)&&(this.value=String(t))},HTMLElement.prototype.getValue=function(){return this instanceof HTMLSpanElement?this.textContent||"":this instanceof HTMLInputElement||this instanceof HTMLSelectElement||this instanceof HTMLTextAreaElement?this.value:""},HTMLElement.prototype.clear=function(){(this instanceof HTMLInputElement||this instanceof HTMLSelectElement||this instanceof HTMLTextAreaElement)&&(this.value="")};export{get,getAll,getData};
//# sourceMappingURL=html.js.map