Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Last active September 12, 2016 22:27
Show Gist options
  • Save salsalabs/e65e28f908ace107aa1b to your computer and use it in GitHub Desktop.
Save salsalabs/e65e28f908ace107aa1b to your computer and use it in GitHub Desktop.
Javascript for perptually recurring donation. See the link for suggestions about CSS for the added disclaimer.
<script type="text/javascript">
$(document).ready(function () {
var term = $('select[name=TERM]');
var disclosure = 'Your recurring donation will be automatically deducted '
+ 'from your account on a monthly basis.';
term.parent()
.after('<input type="hidden" name="PAYPERIOD" value="MONT"/>')
.after('<input type="hidden" name="TERM" value="9999"/>')
.after('<div class="perpetual-disclaimer">' + disclosure + '</div>')
.remove();
$('select[name=PAYPERIOD]').parent().remove();
$('#recurring_options').html($('#recurring_options').html().replace('times', ''));
$('.link-help').hide()
$('#recurring').click()
// If you would like to have the donation page be only for the monthly amount
// and not have an option for a one-time amount, then remove '//' from the next line.
//$('input[name=recurring]').parent().hide()
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment