Skip to content

Instantly share code, notes, and snippets.

@michaelglass
Created November 22, 2016 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelglass/f7cdffdc64e4582be5c77abddc04af73 to your computer and use it in GitHub Desktop.
Save michaelglass/f7cdffdc64e4582be5c77abddc04af73 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
<select id="backgroundColorSelector">
<option value="blue">Blue</option>
<option value="yellow">Yellow</option>
<option value="red">Red</option>
<option value="coral">Coral</option>
</select>
<script>
var select = document.getElementById('backgroundColorSelector');
select.addEventListener('change', function(event) {
console.log(event);
document.body.style.backgroundColor = event.target.value
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment