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.
Dropdown:
<select id=ThemeSelect>
<option value=zelda>Zelda</option>
<option value=smb2>SMB 2</option>
</select>
For reference, this code is with some Javascript in a Wordpress widget that changes the css code, like a theme selector.
How would I make this save as a cookie? I feel like I've tried everything!
EDIT:
I should have said, but I use this code to change the CSS:
var saveclass = null;
var sel = document.getElementById('ThemeSelect');
sel.onchange = function(){
saveclass = saveclass ? saveclass : document.body.className;
document.body.className = saveclass + ' ' + sel.value;
};