Better handle contact form JS
Some checks failed
Build and Deploy to Web Server / deploy (push) Failing after 11m57s

This commit is contained in:
2025-08-29 12:52:22 +09:30
parent 52362b748b
commit 7c8ab1c988

View File

@@ -58,7 +58,7 @@ const ID = `contact-form-${Math.random().toString(36)}`;
</form>
<script define:vars={{ ID }}>
document.addEventListener("astro:page-load", () => {
function init() {
const form = document.getElementById(ID);
const responseMsg = form.querySelector("#response-message");
const button = form.querySelector("#submit");
@@ -98,5 +98,8 @@ const ID = `contact-form-${Math.random().toString(36)}`;
button.disabled = false;
}, 10000);
});
});
}
init();
document.addEventListener("astro:after-swap", init);
</script>