Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio buttons - change value with js

Status
Not open for further replies.

zooraw

Programmer
Jun 27, 2003
18
US
I have

<td><span style=&quot;font-size:10pt;fontweight:bold;&quot;>Sold</span></td>

<td><input id=&quot;Sold&quot; type=&quot;radio&quot; name=&quot;Sold&quot; Checked Value=&quot;1&quot;>Yes
<input id=&quot;Sold&quot; type=&quot;radio&quot; name=&quot;Sold&quot; Value=&quot;0&quot;>No
</td>

How can I set the value from 1 to 0 with javascript?

I'm trying
document.MyForm.Sold.value = &quot;0&quot;;
But that is not working.

Thanks!
 
Nevermind....figured it out.

thread216-614818
 
radio buttons share the same name, so you have to reference their value individualy using an array syntax.

document.MyForm.Sold[0].value = &quot;0&quot;
document.MyForm.Sold[1].value = &quot;0&quot;

This would set both of your radio button values to 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top