Show and Hide DIV’s after 5000 seconds when .wpcf7-mail-sent-ok

I made a Contact Form 7 with a custom “Thank You!” message that appears after wpcf7mailsent.

I need it to reverse after seconds. My current code does not work:

addEventListener('wpcf7mailsent', function(event) {
    event.preventDefault();
    document.querySelector('.qtWRP').style.display = 'none';
    document.querySelector('.inputBTMx').style.display = 'none';
    document.querySelector('.cap').style.display = 'none';
    document.querySelector('.qtWRP2').style.display = 'block';
});

wpcf7Elm.addEventListener( 'wpcf7-mail-sent-ok', function( event ) {
jQuery ( 'form.wpcf7form' )[1000].reset();
}, false );;

Appreciate any help.

enter image description here

enter image description here