Radiobuttonlist client side javascript question


in HTML if i want to find the length or loop through an array of radio buttons in the browser i can usually go document.getElementById("arrayName").length;  cant I?

when you create a radiobuttonlist in it creates the correct radio tags on client side but it also surrounds them in a table with the same name.  you know that by naming the radios all the same it creates an array of the radios but throws in a table of the same name and i cant seem to access the radio buttons.

when i go document.getElementById("arrayName") it returns the table and therefore i cant get the radios.

any ideas on how to sort this one out

thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hmm. If you open the View Source for the web page, you would see that, generates unique id's for each radio button in the list, and they will be in certain order. If your radioButtonList id is "arrayName", then lets say you have 3 radio buttons in the list, then the id's will be "arrayName_0", "arrayName_1" and "arrayName_2".

So to access the first radio button, you should use document.getElementById("arrayName_0");
Quintin79Author Commented:
yes i know this and its the very last option.  the reason is that in most cases the radiobutton list will be of any size it wants so i wont know how many rb objects i have to loop through.  
Instead of
have you tried
?  (Might need to check the client-side View Source to verify the common radio button name -- that's name, not ID -- for this.)
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

I do not understand your question. What do you want to achieve? Length of the radio buttonlist, you mean how many radio buttons in the list?
Quintin79Author Commented:
ryerras - yes.  that way i can loop thru it in javascript.
hmm ok. Nothing cant be done in javascript, use this following two lines to find the length of the tables, when i say length of the table, that is number of rows,

var rbListTable = document.getElementById("RadioButtonList1").childNodes[0];
var tableRows = rbListTable.childNodes;
var tabLen= tableRows.length

After you get that, you know what you have to do, loop through from 0 to tabLen-1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Quintin79Author Commented:
oh man is that all i can do ?  thats a let down.  anyway thanks - your answer is the go.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.