JSFiddle - React, Tailwind, and code Playground
HTML
<p class="question">1. What is the answer to this question?</p>
<ul class="answers">
<input type="radio" name="q12" value="a" id="q1a" checked><label for="q1a">Answer 1</label><br/>
<input type="radio" name="q12" value="b" id="q1b"><label for="q1b">Answer 2</label><br/>
<input type="radio" name="q12" value="c" id="q1c"><label for="q1c">Answer 3</label><br/>
<input type="radio" name="q12" value="d" id="q1d"><label for="q1d">Answer 4</label><br/>
<button type='button' name='clear' >Clear</button>
</ul>
<p class="question">1. What is the answer to this question?</p>
<ul class="answers">
<input type="radio" name="q1" value="a" id="q1a"><label for="q1a">Answer 1</label><br/>
<input type="radio" name="q1" value="b" id="q1b"><label for="q1b">Answer 2</label><br/>
<input type="radio" name="q1" value="c" id="q1c"><label for="q1c">Answer 3</label><br/>
<input type="radio" name="q1" value="d" id="q1d"><label for="q1d">Answer 4</label><br/>
<button type='button' name='clear' >Clear</button>
</ul>
JavaScript
jQuery(function($) {
$("button").hide();
$("input[type='radio']:checked").each(function(e){
$(this).closest('.answers').find("button").show();
});
$("body").on("change","input[type='radio']" ,function(){
$(this).closest('.answers').find("button").show();
});
$("body").on("click","button" ,function(){
$(this).closest('.answers').find("input[type='radio']:checked").prop("checked",false);
$(this).hide();
});
})