I am working on a WordPress website contact form. Where I would like to redirect the page after the user press the send button and also a 5-sec delay.
The following code works fine with the redirecting but I also would like to wait 5 sec before the redirecting.
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://www.inext.se/career/';
}, 5000 );
</script>
Do anyone knows what I am doing wrong here and why it is redirecting perfectly but not delaying 5 sec.