Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script>
// Add this to the bottom of the contribution/new liquid template
var inputs = document.querySelectorAll('#selectable input');
var amount = document.querySelector('#contribution_amount');
// Sets the amount to be the same as the reward you chose
var select = function (event) {
var input = event.target;
var value = input.getAttribute('data-amount');
if (value) {
amount.value = parseFloat(value);
}
}
// Add a listener to each radio button
for (var i = 0; i < inputs.length; i++) {
inputs[i].addEventListener('click', select);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.