Wednesday, 23 January 2013 13:51

how to get RadioButtonList selected index and text using jquery

Written by 
Rate this item
(0 votes)

if you want to get the selected index or text of a asp.net
RadioButtonList using jquery then use the codes below -

$(document).ready(function () {
$("#<%= csiRadioButtonList.ClientID %>").live('change', function () {
var radChecked = $("[id*=csiRadioButtonList] input:checked");
if (radChecked.next().text() == "selected item1")
{
alert(radChecked.next().text());
}

});
});

here this function $("#<%= csiRadioButtonList.ClientID %>").live('change', function ()
fired when any radio button checked.its works well so that the above function
only fires when radio button checkd or clicked not that the text is clicked.
here radChecked gets the item checked.then radChecked.next().text() gets
the text selected.

hope it helps you very very much.

Read 7556 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.