elements :

Sample Code

This is a demo for "disabled" and "elements" attributes of "fieldset" tag.


  <fieldset id="fs" disabled>
    <label name="ts">The node below is disabled:</label>
    <p><label><input type=radio name=c value=0 checked> Black on White</label>
    <p><label><input type=radio name=c value=1> White on Black</label>
    <p><label><input type=checkbox name=g> Use grayscale</label>
    <p><label>Enhance contrast <input type=range name=e list=contrast min=0 max=100 value=0 step=1></label>
    <datalist id=contrast>
      <option label=Normal value=0>
      <option label=Maximum value=100>

    function output() {
      var e = document.getElementById("fs");
      var re1 = document.getElementById ('result1');
      var re2 = document.getElementById ('result2');
      var re3 = document.getElementById ('result3');
      re1.textContent +="elements length : "+e.elements.length;
      re2.textContent +="elements item(1) : "+e.elements.item(1);
      re3.textContent +="elements namedItem(\"ts\") : "+e.elements.namedItem("ts");
      return false;
    <input type="button" value="Click" onClick="output()" />
  <p>elements : <br>
    <output id="result1"></output><br>
    <output id="result2"></output><br>
    <output id="result3"></output><br>