From 4818db3f9dfa8b349111357b5b60ee71325699a0 Mon Sep 17 00:00:00 2001 From: Lino Schmidt Date: Thu, 15 Jun 2023 19:26:43 +0200 Subject: [PATCH] Better textarea autoresize --- src/static/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/static/index.js b/src/static/index.js index eb7e9d6..7a79c16 100644 --- a/src/static/index.js +++ b/src/static/index.js @@ -73,4 +73,16 @@ function exportReport() { calendarTextarea.value = 'Error während des Abrufs'; console.error(error); }); -} \ No newline at end of file +} + +function autoResize(textarea) { + textarea.style.height = "auto"; + textarea.style.height = textarea.scrollHeight + "px"; +} + +calendarTextarea.addEventListener('input', () => { + autoResize(calendarTextarea); +}); +untisTextarea.addEventListener('input', () => { + autoResize(untisTextarea); +}); \ No newline at end of file