title: How do I get the label of the selected radio button using javascript
body: <p>I have the following HTML</p>
  
  <pre><code>&lt;div class="form-radios" id="edit-submitted-lunchset-lunch"&gt;&lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" value="1" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-1"&gt;  &lt;label for="edit-submitted-lunchset-lunch-1" class="option"&gt;12:00 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" value="2" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-2"&gt;  &lt;label for="edit-submitted-lunchset-lunch-2" class="option"&gt;12:30 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" value="3" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-3"&gt;  &lt;label for="edit-submitted-lunchset-lunch-3" class="option"&gt;13:00 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" value="4" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-4"&gt;  &lt;label for="edit-submitted-lunchset-lunch-4" class="option"&gt;13:30 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" value="5" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-5"&gt;  &lt;label for="edit-submitted-lunchset-lunch-5" class="option"&gt;14:00 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;div class="form-item form-type-radio form-item-submitted-lunchset-lunch"&gt;
  &lt;input type="radio" class="form-radio" checked="checked" value="6" name="submitted[lunchset][lunch]" id="edit-submitted-lunchset-lunch-6"&gt;  &lt;label for="edit-submitted-lunchset-lunch-6" class="option"&gt;14:30 &lt;/label&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am trying to retrieve the label associated with the radio button instead of the value using the following javascript but the variable "chosentime" is still "unassigned". I checked my code by throwing in a few alerts the alert(radios[i].innerhtml); throws unassigned</p>
  
  <pre><code>var radios = document.getElementsByName('submitted[lunchset][lunch]');
  for (var i = 0, length = radios.length; i &lt; length; i++) {
      if (radios[i].checked) {
          alert(i);
          alert(radios[i].value);
          alert(radios[i].innerhtml);
          chosentime = radios[i].innerhtml;
      }
  }
  window.alert(chosentime);
  }
  </code></pre>
  
  <p>Would appreciate any help. Thanks in advance.</p>