I'm building a donation form.
If a checkbox with a fixed amount is checked by the user, I would like it to automatically uncheck if next the user clicks the textbox to insert a custom amount.
I know nothing of JavaScript. Will someone help me achieve this?
<form action="http://ift.tt/rDmnwQ" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="louzanimalespaypal@gmail.com">
<input type="checkbox" name="amount" class="checkbutton" value="5.00"><span>€05.00</span>
<input type="checkbox" name="amount" class="checkbutton" value="5.00"><span>€10.00</span>
<input type="checkbox" name="amount" class="checkbutton" value="5.00"><span>€15.00</span>
<input type="checkbox" name="amount" class="checkbutton" value="5.00"><span>€20.00</span>
<br>
<strong>Other Amount</strong><br>
$ <input type="text" class="TextBox" name="amount">
<input type="hidden" name="item_name" value="Donation">
<input type="hidden" name="item_number" value="Donation">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="PT">
<input type="hidden" name="bn" value="Louzanimales_Donation_WPS_PT">
<input type="hidden" name="return" value="http://ift.tt/2hQztX7">
<br /><br />
<input type="submit" value="Pay with PayPal!">
</form>
.
<script>
$('input.checkbutton').on('change', function() {
$('input.checkbutton').not(this).prop('checked', false);
});
</script>
Aucun commentaire:
Enregistrer un commentaire