Showing posts with label RadioButtonList get selected value. Show all posts
Showing posts with label RadioButtonList get selected value. Show all posts

Thursday, January 24, 2019

get RadioButtonList selected value.

You can use jQuery / JavaScript to get the selected value of a RadioButtonList . jQuery provides much more simpler approach as shown below.

jQuery
var selectedVal = $('#<%= RadioButtonList.ClientID %> input:checked').val();

JavaScript

var radioList= document.getElementById("<%= RadioButtonList.ClientID %>");
 var options= radioList.getElementsByTagName("input");
 var selected;
 for (var i = 0; i < options.length; i++) {
      if (options[i].checked) {
          selected = options[i];
          break;
       }
  }
  if (selected) {
       alert(selected.value);
  }

Regards,
Samitha