EDIT** Bouchaala Sabri Answer worked perfectly
I am having a problem with some jquery that i am trying to include into my page. For some reason its not working. not sure if the script is wrong or if jquery is being pulled in correctly.
Its basically a script that lets a user choose one option from the top three radio buttons, one option from the second lot of three, but if any of the bottom three are checked the top 6 will be unchecked if they have previouslly been checked.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$yearstages = $('input[name="keystage1yr2"],input[name="keystage1yr1"]');
$savestages = $('input[name="keystage1save"]');
$('#radios').on('change', 'input', function() {
if (this.name == "keystage1save") {
$yearstages.filter('input:checked').prop('checked', false);
} else {
$savestages.filter('input:checked').prop('checked', false);
}
});
</script>
</head>
<body>
<div id="radios">
<p>
<input class="radio" type="radio" name="keystage1yr1" value="Paper" /> <span>£25</span>
<input class="radio" type="radio" name="keystage1yr1" value="CD" /> <span>£25 excl VAT</span>
<input class="radio" type="radio" name="keystage1yr1" value="Paper & CD" /> <span>£40 excl VAT</span>
</p>
<p>
<input class="radio" type="radio" name="keystage1yr2" value="Paper" /> <span>£25</span>
<input class="radio" type="radio" name="keystage1yr2" value="CD" /> <span>£25 excl VAT</span>
<input class="radio" type="radio" name="keystage1yr2" value="Paper & CD" /> <span>£40 excl VAT</span>
</p>
<p>
<input class="radio" type="radio" name="keystage1save" value="Paper" /> <span>£47.50</span>
<input class="radio" type="radio" name="keystage1save" value="CD" /> <span>£47.50 excl VAT</span>
<input class="radio" type="radio" name="keystage1save" value="Paper & CD" /> <span>£75 excl VAT</span>
</p>
</div>
you should never forget to wrap your code in