I have an ASP.NET web page with a databound RadioButtonList. I do not know how many radio buttons will be rendered at design time. I need to determine the SelectedValue on the client via JavaScript. I’ve tried the following without much luck:
var reasonCode = document.getElementById('RadioButtonList1'); var answer = reasonCode.SelectedValue;
(‘answer’ is being returned as ‘undefined’) Please forgive my JavaScript ignorance, but what am I doing wrong?
Thanks in advance.
ASP.NET renders a table and a bunch of other mark-up around the actual radio inputs. The following should work:-