123
rated 0 times
[
130]
[
7]
/ answers: 1 / hits: 17728
/ 13 Years ago, fri, december 2, 2011, 12:00:00
I need to select a radio button dynamically.
i) I have created few radio buttons dynamically, i.e. in a function using:
function funcName()
{
Something.innerHTML = '<input type = radio name = rName id = 1 />' + '<input type = radio name = rName id = 2 />' + '<input type = radio name = rName id = 3 />';
}
ii) I need to select a radio button dynamically, in another function:
function funcNAme(someVar)
{
document.getElementById(someVar).checked = true;
}
But this does not work, i.e. the radio button doesn not get selected. However, 'disabled' works fine.
Also:
alert(someVar);
returns the appropriate desired value.
More From » function