I'm having a problem with getting a radio button to deselect.
I've got the following buttons:
<input type="radio" name="sex" value="Male">Male</input>
<input type="radio" name="sex" value="Female">Female</input>
<input type="radio" name="sex" value="Unknown">Unknown</input>
In the pagebeforeshow I've got:
$('input:radio[name=sex]').attr('checked',false);
The first time the page displays, no button is selected. I select a button and dismiss then page and when I redisplay the page the radio button is still selected,
What am I missing?
Some additional details:
In pagebeforeshow I use
$('input:radio[name=sex]:checked').val();
to print out the value of the checked radio button.
The first time the page displays the value is
undefined
and no radio buttons show as checked when the page display.
I select a radio button and leave the page. Before I exit the page, I use:
$('input:radio[name=sex]').attr('checked',false);
to deselect the button.
When I navigate back to the page, pagebeforeshow prints the value as
undefined
which I expect.
But when the page displays the audio button that was selected when I left the page is still selected.
How could the value print as undefined but the button show as checked when the page display?