title: I need to select multiple SPAN elements
body: <p>On my web page I want to 'hide' or 'unhide' several elements (C and F in this example) that are already inside a DIV element, 
  such as:</p>
  
  <pre><code>&lt;div&gt; Select A or B &lt;span name='hide' &gt; or C&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt; Also select D or E &lt;span name='hide' &gt; or F&lt;/span&gt;&lt;/div&gt;
  (etc)
  </code></pre>
  
  <p>I use javascript to hide all 'hide' elements when the page is opened, except when the page is opened on localhost, than all is shown.
  I do not necessarily know how many 'hide' elements there are (dynamically generated).</p>
  
  <pre><code>var hids=document.getElementsByName('hide');
  if(hids!=null) {
      for(var j=0; j&lt; hids.length; j++) {
          if(localhost==true) { // only if on localhost
              hids[j].style.visibility='visible';
          }
          else hids[j].style.visibility='hidden';
      }
  }
  </code></pre>
  
  <p>But, the 'name' attribute is not valid for SPAN. When  I use DIV instead of SPAN it messes up the format. How should I solve this properly?</p>