document.getElementsByName returns elements more than expected

Posted by Homer on Stack Overflow See other posts from Stack Overflow or by Homer
Published on 2010-04-21T18:37:49Z Indexed on 2010/04/21 18:53 UTC
Read the original article Hit count: 170

Filed under:
|
|

I have a RadioButtonList

<asp:radiobuttonlist runat="server" id="rblList">
    <asp:listitem>s1</asp:listitem>
    <asp:listitem>s2</asp:listitem>
    <asp:listitem>s3</asp:listitem>
    <asp:listitem>s4</asp:listitem>
</asp:radiobuttonlist>

In my client code I'm grabbing the array of radio buttons like this

var elements = document.getElementsByName("rblList");

Why am I getting 5 items instead of 4? It makes elements like a 1 based array.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about html