Hi,
I have a Hubspot Landing page with a Hubspot form, added with a builder. I need to add a few seconds of a delay before submission starts. I tried with JavaScript to do that, but my code in not working, addEventListener not working on a Form object, and returns null, even console.log prints that object.
<script type="text/javascript">
window.addEventListener('message', event => {
let $myForm = document.querySelector("form");
console.log($myForm);
$myForm.addEventListener('submit', function(ev) {
ev.preventDefault();
setTimeout(function() {
ev.target.submit();
}, 20000);
});
});
</script>
Is there any way to fix this, or is there any better way to delay form submission in Hubspot Landing page?
Thanks in advance for your help!