title: Change select to check boxes using javascript
body: <p>The reason I would like to do this, is that it will be situational. If a user is logged in, they will see drop downs. If not, they will see a list of text. Ideally just plain text, but I don't know if that's possible, so I was thinking I could convert the <code>&lt;select&gt;</code> to checkboxes and hide the check boxes with CSS. </p>
  
  <p>Basically we don't want a user who isn't logged in to feel they can select anything, because they won't be able to order and this could lead to frustration. But we would still like them to view what options are available for each product as unselectable text. If there is a better way to do this than what I'm thinking, I'd be grateful for suggestions. For now, this is what I've patched together, but it's not changing the select to checkboxes.</p>
  
  <p>I grabbed some code from here to use as a starting point: <a href="http://www.w3schools.com/jsref/met_element_setattribute.asp" rel="nofollow">http://www.w3schools.com/jsref/met_element_setattribute.asp</a></p>
  
  <p>Also, I can't grab the &lt; select > by id, because this will be on all &lt; select >'s.</p>
  
  <pre><code>&lt;select id="unique_id" class="unique_class"  data-attribute_name="unique_attribute_name" name="unique_name"&gt;
      &lt;option value="" selected="selected"&gt;Choose an option&lt;/option&gt;
      &lt;option class="attached enabled" value="516"&gt;5/16"&lt;/option&gt;
      &lt;option class="attached enabled" value="38"&gt;3/8"&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function myFunction() {
      document.getElementsByTagName("SELECT")[0].setAttribute("type", "checkbox"); 
  }
  </code></pre>
  
  <p>Here is a fiddle: <a href="https://jsfiddle.net/d4qdekom/" rel="nofollow">https://jsfiddle.net/d4qdekom/</a></p>