Contact Form 7 Conditional redirect

I got an answer. We need to grab the code inside the Event Listener code like this:

<script type="text/javascript">
document.addEventListener( 'wpcf7submit', function( event ) {
inputs = event.detail.inputs;
inputs.forEach( function(el) {
    if ( el.name == "menu-52" ) {
        if ( el.value == "Below $10,000" ) {
            location.href = "https://www.facebook.com";
        } else if ( el.value == "Above $10,000" ) {
            location.href = "https://google.co.in";
        }
    }
});
}, false );
</script>

Thank you.