JSFiddle - React, Tailwind, and code Playground
by serio
HTML
<!-- I have many sets of these yes or no radios, many groups with the same names -->
<p class="halfhalf">
<LABEL for="applied_before" class="c1"> Have you ever applied for a grant before? </LABEL>
<input name="applied_before"
type="radio" value="1" class="radio toggleAdiv">
<label class="radiolabel">Yes</label>
<input name="applied_before"
type="radio" value="0" class="radio toggleAdiv">
<label class="radiolabel">No</label>
</p>
JavaScript
$(function()
{
$('input[type="radio"]').click(function(){
myFriends = $('input[type="radio"][name="' + $(this).attr('name') + '"]');
console.log( myFriends );
myFriends.val( $(this).val() );
console.log( myFriends );
});
});