From 0c25f37a2f1c5fed78d46da2f7be79a2bdf073ec Mon Sep 17 00:00:00 2001 From: Marie Birner Date: Fri, 7 Apr 2023 11:45:12 +0200 Subject: [PATCH] [BUGFIX] clone node form element --- frontend/main.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/main.ts b/frontend/main.ts index 58268db..890decb 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -65,7 +65,8 @@ function initSidebar() { function initTripSidebar(triggerElement: HTMLElement) { const sidebarElement = document.querySelector('#addTrip'); if(sidebarElement && triggerElement.dataset.form && triggerElement.dataset.header) { - let formElement = document.querySelector(triggerElement.dataset.form); + let form = document.querySelector(triggerElement.dataset.form); + let formElement = form.cloneNode(true); let formContainerElement = sidebarElement.querySelector('.form-js'); if(formContainerElement) { formContainerElement.innerHTML = '';