Created
November 30, 2017 11:58
-
-
Save crowdfundhq/0fc299e37dad68de7a1a79f28e348bec to your computer and use it in GitHub Desktop.
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> | |
// 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