function load() { for (const elm of document.querySelectorAll("form > button")) { elm.addEventListener('click', (e) => { e.target.parentElement.classList.add("submitted"); }); } } window.onload = load; htmx.on('htmx:afterSwap', load);