Wednesday, October 01, 2008 11:17 AM azamat_ali

How to access Radio Button List in the Javascript

                // ***** First Method *****//
                var rdolist = document.getElementsByName("rdolist");
                
                if (rdolist[1].checked)
                    txtMessage.value = "First";
                if (rdolist[2].checked)
                    txtMessage.value = "Second";
                if (rdolist[3].checked)
                    txtMessage.value = "Third";
                
                
 

               // ***** Second Method *****//
                var rdolist_0 = document.getElementById("rdolist_0");
                var rdolist_1 = document.getElementById("rdolist_1");
                var rdolist_2 = document.getElementById("rdolist_2");
                if (rdolist_0.checked)
                    txtMessage.value = "First";
                if (rdolist_1.checked)
                    txtMessage.value = "Second";
                if (rdolist_2.checked)
                    txtMessage.value = "Third";

Filed under: , , ,

Comments

# re: How to access Radio Button List in the Javascript

Wednesday, October 27, 2010 7:28 AM by ss

This does not work for me...

# re: How to access Radio Button List in the Javascript

Wednesday, April 27, 2011 8:54 AM by sudhir kotila

i am very very impressed...................

# re: How to access Radio Button List in the Javascript

Thursday, May 19, 2011 4:21 AM by MAhmoud

This is doesn't work

# re: How to access Radio Button List in the Javascript

Wednesday, June 01, 2011 3:00 PM by Suma

It worked Thanks soo much :)

# re: How to access Radio Button List in the Javascript

Tuesday, June 21, 2011 6:27 AM by AChala

Thanks for the code.I'm a student from Sri Lanka.

# re: How to access Radio Button List in the Javascript

Wednesday, June 29, 2011 7:44 AM by sheetal

thanx a lot..it worked

# re: How to access Radio Button List in the Javascript

Wednesday, August 31, 2011 3:39 PM by ImGreg

Works great.  Saved me a lot of confusion and frustration!  Thanks!

# re: How to access Radio Button List in the Javascript

Monday, October 31, 2011 9:38 PM by 21JaneGunish

Nice stuff imho. Keep it up!

21Jane Gunish

<a href="dutch-escort.com/">dutch escorts</a>

# re: How to access Radio Button List in the Javascript

Saturday, November 05, 2011 12:02 AM by RoseBodge

Good stuff  at least I thing so. Keep writing such stuff!

Rose Bodge

<a href="black-escort-london.com/">black girls escort</a>

# re: How to access Radio Button List in the Javascript

Thursday, December 22, 2011 6:02 AM by pravin

Does not Work for me!!!

Leave a Comment

(required) 
(required) 
(optional)
(required)