Reputation: 73
I have a radio group of 3 choices of which the first is selected by default. I want to make it to where the second one is selected upon clicking another item. This is what I have...
function selectSS()
{
document.getElementById("width").value=16;
document.getElementById("gauge_1").checked;
}
I then use onClick to call the function, the value of width changes to 16 like it is supposed to but how do I get it to select the radion button with the id gauge_1?
Upvotes: 0
Views: 63
Reputation: 50913
You have to set its checked
state to true
, so use:
document.getElementById("gauge_1").checked = true;
In your code, you're getting it and doing nothing with it.
Reference:
Upvotes: 2