Better handle contact form JS
Some checks failed
Build and Deploy to Web Server / deploy (push) Failing after 11m57s
Some checks failed
Build and Deploy to Web Server / deploy (push) Failing after 11m57s
This commit is contained in:
@@ -58,7 +58,7 @@ const ID = `contact-form-${Math.random().toString(36)}`;
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script define:vars={{ ID }}>
|
<script define:vars={{ ID }}>
|
||||||
document.addEventListener("astro:page-load", () => {
|
function init() {
|
||||||
const form = document.getElementById(ID);
|
const form = document.getElementById(ID);
|
||||||
const responseMsg = form.querySelector("#response-message");
|
const responseMsg = form.querySelector("#response-message");
|
||||||
const button = form.querySelector("#submit");
|
const button = form.querySelector("#submit");
|
||||||
@@ -98,5 +98,8 @@ const ID = `contact-form-${Math.random().toString(36)}`;
|
|||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}, 10000);
|
}, 10000);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
document.addEventListener("astro:after-swap", init);
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user