title: Dynamic radio buttons
body: <p>I am using the following code to generate dynamic radio buttons according to an array.
  This code generate number of radio buttons with its labels vertically.
  When I try to get the checked radio button, I pass the name of the radio group to document.getElementsByName(). This return a node list item contain all radio buttons.</p>
  
  <p>Console.log() shows node list's content as following:</p>
  
  <pre><code>       [item: function]: 
         0: input#r1
         1: input#r2
         2: input#r3
  </code></pre>
  
  <p>When I try to get the length of the node list, i got it 0, so that i can not access to the node list to get the checked radio button. </p>
  
  <pre><code>      ee.length /// 0
  </code></pre>
  
  <p>Could you please help me to find out why its length is 0?</p>
  
  <p>// code</p>
  
  <pre><code>function addradiobutton( arr) {
  
          var foo = document.getElementById("mydiv");     
          for(var i=0;i&lt;arr.length;i++){
              var label = document.createElement("label");
              var element = document.createElement("input");
              element.setAttribute("type", "radio");
              element.setAttribute("value", arr[i]);
              element.setAttribute("name", "gr");
              element.setAttribute("id", arr[i]);
              if (i==0)
                element.setAttribute("checked", true);
              label.appendChild(element);
              label.innerHTML += arr[i];
              label.innerHTML += '&lt;br /&gt;';
              foo.appendChild(label);
          }
      }
  </code></pre>