[BUGFIX] duplicate ids checkboxes in sidebar form

This commit is contained in:
Marie Birner
2023-06-08 15:28:08 +02:00
parent 91fff843cb
commit 6f2071df37
2 changed files with 12 additions and 1 deletions

View File

@ -189,6 +189,17 @@ function initTripSidebar(triggerElement: HTMLElement) {
let body = <HTMLElement>document.querySelector(triggerElement.dataset.body);
let bodyElement = <HTMLElement>body.cloneNode(true);
let bodyContainerElement = <HTMLElement>sidebarElement.querySelector('.body-js');
/* Quickfix duplicate ids checkboxes */
const checkboxes = <NodeListOf<HTMLElement>>bodyElement.querySelectorAll('input[type="checkbox"]');
Array.prototype.forEach.call(checkboxes, (checkbox: HTMLElement) => {
if(checkbox) {
checkbox.parentElement?.setAttribute('for', checkbox.id + 'js');
checkbox.id += 'js';
}
});
if(bodyContainerElement) {
bodyContainerElement.innerHTML = '';
bodyContainerElement.append(bodyElement);