Open button link in a new tab AND redirect current tab

Hello

I have a button which when clicked, opens a site in a new tab (e.g. Facebook.com).

However, I also want the current tab to redirect to another page of my site, e.g. a ‘Success’ page.

I setup the button link to open in a new tab, and it works great, however, when I add my code, it overrides this and ONLY opens the page I want (‘/success’) in the current tab.

I have this code:

<script>

var BTN_1 = document.getElementById('cta');

//Do Something
function pageRedirect() {
      window.location.href = "/success";
  } 

BTN_1.onclick = pageRedirect; //Start action on click

</script>

Is there anything I can add / tweak above, in order to allow me to redirect in the current tab AND open the link I wanted in a new tab?

Hey, is anyone able to help please? :pray:

Add custom code block (Add element > embed) to form below submit button. Add following code to custom block:

<script>
document.getElementById('submitbtn').addEventListener('click', function() {
window.open("https://www.google.com", "_blank")
})
</script>

Change button ID (for in page linking) to submitbtn. Change https://www.google.com to new tab link. And set a redirect in the form settings: (“/success” for example)