diff --git a/autosize.js b/autosize.js new file mode 100644 index 0000000..eabae69 --- /dev/null +++ b/autosize.js @@ -0,0 +1,10 @@ +function autosize(tx) { + for (let i = 0; i < tx.length; i++) { + tx[i].setAttribute("style", "height:" + (tx[i].scrollHeight) + "px;overflow-y:hidden;"); + tx[i].addEventListener("input", OnInputAutoSize, false); + } +} +function OnInputAutoSize() { + this.style.height = "auto"; + this.style.height = (this.scrollHeight) + "px"; +} \ No newline at end of file