Last active
March 21, 2024 14:06
-
-
Save RobertCam/15990124d7b9622e0503422e7305c8c5 to your computer and use it in GitHub Desktop.
Have an Unbounce form redirect to different URLs based on a dropdown selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* | |
Unbounce Community :: Tips & Scripts :: Dynamic Form Confirmation URL's Using Browser Redirects | |
TS:0002-04-051 | |
*********************** | |
Do not remove this section. It helps our team track useage of external workarounds. | |
*/ | |
var url = $("#destination"); | |
var formDestination = document.getElementById('form_destination'); // Add ID of dropdown field | |
// Add URLs for dropdown options | |
destination1 = 'community.unbounce.com'; | |
destination2 = 'unbounce.com/blog/'; | |
destination3 = 'google.ca'; | |
$(formDestination).change(function() { | |
if (formDestination.selectedIndex == 1) { | |
$(url).val(destination1); | |
} else if (formDestination.selectedIndex == 2) { | |
$(url).val(destination2); | |
} else if (formDestination.selectedIndex == 3) { | |
$(url).val(destination3); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment