title: Change the color of an option when selected
body: <p>I want an option to change color when selected by a user. For Example: a user selects the red option then a function would run that would change the color red. If the user then selected green then it would change green. etc. </p>
  
  <pre><code>&lt;select onchange="changeColor();" class="color" id="rgb"&gt;
    &lt;option id="red" value="Red"&gt;Red&lt;/option&gt;
    &lt;option id="green" value="Green"&gt;Green&lt;/option&gt;
    &lt;option id="blue" value="Blue"&gt;Blue&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I started with the function below but I'm not sure where I went wrong.</p>
  
  <pre><code>function changeColor() {
      var red = document.getElementById('red');
      var green = document.getElementById('green');
      var blue = document.getElementById('blue');
  
      if(event.target.value == red) {
        red.style.color = "red";
      } else if(event.target.value == green) {
        green.style.color = "green";
      } else if(event.target.value == blue) {
        blue.style.color = "blue";
      } else  {
        alert("There was an error!");
        }
    };
  </code></pre>