title: Saving dropdown menu selection in a cookie?
body: <p>I've seen this posted a few times, but I wasn't able to get the code working at all.
  I need help making this drop down menu save its settings to a cookie, so when the user visits the site again, their previous selection is retained.</p>
  
  <p>Dropdown:</p>
  
  <pre><code>&lt;select id="ThemeSelect"&gt;
      &lt;option value="zelda"&gt;Zelda&lt;/option&gt;
      &lt;option value="smb2"&gt;SMB 2&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>For reference, this code is with some Javascript in a Wordpress widget that changes the css code, like a theme selector.</p>
  
  <p>How would I make this save as a cookie? I feel like I've tried everything!</p>
  
  <p>EDIT:
  I should have said, but I use this code to change the CSS:</p>
  
  <pre><code>var saveclass = null;
  var sel = document.getElementById('ThemeSelect');
  sel.onchange = function(){
      saveclass = saveclass ? saveclass : document.body.className;
      document.body.className = saveclass + ' ' + sel.value;
  };
  </code></pre>