Skip to content

Instantly share code, notes, and snippets.

@crowdfundhq
Created November 30, 2017 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowdfundhq/0fc299e37dad68de7a1a79f28e348bec to your computer and use it in GitHub Desktop.
Save crowdfundhq/0fc299e37dad68de7a1a79f28e348bec to your computer and use it in GitHub Desktop.
<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