RSS

radiobuttonlist selected value javascript

16 May
<script type="text/javascript">
    function SelectedRBL() {
        var list = document.getElementById('<%= rblPollAnswers.ClientID %>'); //Client ID of the radiolist
        var inputs = list.getElementsByTagName("input");
        var selected;
        for (var i = 0; i < inputs.length; i++) {
            if (inputs[i].checked) {
                selected = inputs[i];
                break;
            }
        }
        if (selected) {
            alert(selected.value);
        }
    }
</script>
<asp:RadioButtonList ID="rblPollAnswers" runat="server" />
<asp:Button ID="btnVote" runat="server" Text="Vote" OnClientClick="SelectedRBL();return false;" />
Advertisements
 
Leave a comment

Posted by on May 16, 2013 in Java Script

 

Tags: , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: