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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio buttons in a table

Status
Not open for further replies.

JimFL

Programmer
Jun 17, 2005
131
GB
Hi,

Is there a way to use the DOM to uncheck all of my radio buttons (dynamic set names) within a table. I will be able to get the name of the table by

document.getElementById("mytable");

I want to cycle through all radio buttons in the table and uncheck each one.

I think this is possible but cant find any resources on the web at the moment.

Can anybody help?

JimFl

 
Hi

Code:
[b]var[/b] theTable=document.getElementById([i]'mytable'[/i]);
[b]var[/b] inputList=theTable.getElementsByTagName([i]'input'[/i]);
[b]var[/b] inputLength=inputList.length;

[b]for[/b] ([b]var[/b] i=0;i<inputLength;i++) {
  [b]if[/b] (inputList[i].type==[i]'radio'[/i]) inputList[i].checked=[b]false[/b];

Feherke.
 
Thanks for that feherke .
Never seen the input tag name used like that before. Very useful.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top