1

For unbounce, I want to send a user to different thank you page based on the what they select. I added the script below but it isn't working.

Could you please let me know what I am doing wrong ? Thanks for any help!

<script>
   $("#lp-pom-form-501").on('click', function(){
    switch ($("#number_of_providers")){
        case "#1-2":
            window.open("http://google.com");
            break;
        case "#3-4":
            window.open("http://yahoo.com");
            break;
        default:
            break;
    }
});
</script>
Sue11
  • 127
  • 6
  • Looks like you're passing in a selector to the switch, but that isn't going to check anything. You probably need to check the value of it, something like `$("#number_of_providers").val()`. – psdpainter Oct 20 '22 at 17:03

1 Answers1

1

Be sure to first change your form's confirmation to 'Goto another thankyou page' and set a default fallback URL

Set this script to 'before body end tag'

    <script>

$("#your_drop_down_id").on('change', function() {
 
  switch ($(this).val()) {
      
    case '#your_dropdown_field_id':
        window.module.lp.form.data.url= "http://www.google.com";
        break;
    case '#your_dropdown_field_second_id':
        window.module.lp.form.data.url= "http://www.bing.com";
        break;
  }
  
});
  
</script>

Modify or add as many different 'cases' as you need