Skip to content

Instantly share code, notes, and snippets.

@blooski
Created April 2, 2015 03:18
Show Gist options
  • Save blooski/6bd6d29e4e6dca78cb89 to your computer and use it in GitHub Desktop.
Save blooski/6bd6d29e4e6dca78cb89 to your computer and use it in GitHub Desktop.
Two different form actions depending of radio button
jQuery(document).ready(function($) {
var form = $('form[name="pledgeform"]'),
radio = $('input[name="pledge"]'),
choice = '';
radio.change(function(e) {
choice = this.value;
if (choice === 'yes') {
form.attr('action', 'payment.php');
} else {
form.attr('action', 'flat_payment.php');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment