[BUGFIX] clone node form element

This commit is contained in:
Marie Birner 2023-04-07 11:45:12 +02:00
parent 3b04cdc5ca
commit 0c25f37a2f

View File

@ -65,7 +65,8 @@ function initSidebar() {
function initTripSidebar(triggerElement: HTMLElement) {
const sidebarElement = <HTMLElement>document.querySelector('#addTrip');
if(sidebarElement && triggerElement.dataset.form && triggerElement.dataset.header) {
let formElement = <HTMLElement>document.querySelector(triggerElement.dataset.form);
let form = <HTMLElement>document.querySelector(triggerElement.dataset.form);
let formElement = <HTMLElement>form.cloneNode(true);
let formContainerElement = <HTMLElement>sidebarElement.querySelector('.form-js');
if(formContainerElement) {
formContainerElement.innerHTML = '';