Unbounce - Redirect user based on selected option?

338 Views Asked by At

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>

1

There are 1 best solutions below

0
devlopersfield On BEST ANSWER

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