Get the Selected Radiobutton from Radio Button List in Javascript

by ebarcza 8/20/2010 11:56:00 AM

Just pass in the clientid of the Radio button list control and this function will return the ID of the selected radio button so you can do what you want with it.

function GetRBLSelectionID(RadioButtonListID) {
    var RB1 = document.getElementById(RadioButtonListID);
    var radio = RB1.getElementsByTagName("input");
    var isChecked = false;
    var retVal = "";
    for (var i = 0; i < radio.length; i++) {
        if (radio[i].checked) {
            retVal = radio[i].id;
            break;
        }
    }
    return retVal;
}

 

 

Tags: , ,

.NET | JavaScript

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  July 2017  >>
MoTuWeThFrSaSu
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in