This is so basic, but I cant get it.
On a donation form, people select either pre-set amountoptions or 'other'. If they choose 'other', the 'other' radio button must be activated even if a pre-set was selected.
HTML:
<label>
<input type="radio" name="x_ccPayment" class="required" title="*"
value="120" data-payment="once" />
$120</label>
<label>
<input type="radio" name="x_ccPayment" class="required" title="*"
value="50" data-payment="once" />
$50</label>
<label>
<input type="radio" name="x_ccPayment" class="required" title="*"
value="-99" data-payment="once" />
Other:</label>
<input type="text" name="x_ccPayment_other" id="other_once" style="width: 100px;" value="" onKeyUp="checkNumericInput(this)" data-payment="once" class="form-control" />
JQUERY:
$("#other_once").keyup(function(){
var other_once = $("#other_once").val();
if (other_once !=='') {
$("input[name=x_ccPayment]").removeAttr('checked'); // deselect other options
$("input[name=x_ccPayment][data-payment=once][value=-99]").attr('checked','checked'); /auto-select the 'other' radio
}
});
when I look at the Dev tools, i see the radio is checked
correctly, but this does not show on the screen.