Here's my jQuery, thus far:
var themes = {};
themes['blue'] = {
'background': 'blue',
'color': 'white',
};
themes['red'] = {
'background': 'red',
'color': 'green',
};
$("#colors").change(function() {
var theme = $(this).val();
$("body").css(themes[theme]);
Basically, I am looking to change the css based on what the user selects from the #colors dropdown menu:
<select id="colors">
<option selected="selected">Colors:</option>
<option value="Blue">Blue</option>
<option value="Red">Red</option>
</select>
The following worked fine:
var themes = {
blue: {
'background': 'blue',
}
};
$("#colors").change(function() {
var color = themes['blue'];
$("body").css(color);
});
But I want to add support for more than just blue and more than just the background. Any advice would be greatly appreciated!