Using older version of jQuery (1.3)
I have a form like so:
<form id="myForm">
<input type="radio" id="yes" value="yes" /><label for="yes">Yes</label><br />
<input type="radio" id="no" value="no" /><label for="no">No</label>
</form>
My jQuery is as follows:
$('#myForm').change(function() {
if($('#yes').attr('checked')) {
$('#lookUp').show();
}
else if($('#no').attr('checked')) {
$('#lookUp').hide();
$('#yes').attr('checked', false);
}
});
I’m showing a div when the user clicks on “yes” and hiding it when “no” is selected. I would also like to set the checked status of “yes” to false but this is not working. Any suggestions would be greatly appreciated.
Set the Input name attributes to be the same so the form knows they are the same HTML radio button group