How can I make the heading and label text of radio buttons change when a button is checked? This is how my code looks like, but when I press a button nothing happens. Although I think this code is correct:
<script type='text/javascript' src="https://code.jquery.com/jquery- 1.12.1.min.js">
$(function () {
// when the radio changes
$(':radio.radio').on('change', function(e) {
// set text of h1 element
$('h1').text('mmmmm');
});
});
</script>
<h1 style='color:black;font-family:"Courier New", monospace;margin-left:-10px;' id='h1'>#1.Question 1</h1>
<div>
<div>
<input type="radio" name="radio" id="radio2" class="radio"/>
<label for="radio2" style="color:black;font-family:impact;text-align:center;" id='2'>Answer 1</label>
</div>
<div>
<input type="radio" name="radio" id="radio3" class="radio"/>
<label for="radio3" style="color:black;font-family:impact;text-align:center;" id='3'>Answer 2</label>
</div>
<div>
<input type="radio" name="radio" id="radio4" class="radio"/>
<label for="radio4" style="color:black;font-family:impact;text-align:center;" id='4'>Answer 3</label>
</div>