JavaScript: Get RadioButtonList Selection

Please see my other JavaScript articles.

Using JavaScript to determine selections.

First, I’ll begin with a simple asp.net radiobuttonlist control.

1-javascript-getting-rbl-choice

2-javascript-getting-rbl-choice

Though the asp.net control is itself simple to deploy and use with C#, the html that’s rendered is anything but simple.
You may overcome the difficulty of determining which radiobutton in the list is selected by utilizing the HTML input attribute within a JQuery statement.
Since all the radiobuttons within the list share the same name – “rbl_choices,” I need a statement which will determine for me which one is selected and return its id.
If the first radiobutton is selected, the value returned would be “rbl_choices_0,” otherwise it would be “rbl_choices_0.”

4-javascript-getting-rbl-choice

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 )

Connecting to %s