title: Jquery or Javascript to change just the text color of a selected DropDownList Item
body: <p>I can't seem to figure this out. I have an asp DropDownList control. This gets populated by a class list of data I get from SQL. The DropDownList is in an ASP Repeater. I added an OnSelectedIndexChanged property to the asp control that fires a C# method. I have some logic in the initializing method for the DropDownList that sets a specific item's text color to red (depending on a value in that items class). Whenever that item is selected the text is not red. The text is only red when it is an item within the list. How can I change the color of the selected item? I cannot seem to figure this out. I need the OnSelectedIndexChanged method on the C# side to fire an event to filter another selector. So I am already firing an event when the selector is changed. However I have tried the following:</p>
  
  <pre><code>protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e)
  {
      if (sender != null)
      {
          DropDownList DropDownList1 = (DropDownList)sender;
          DropDownList1.SelectedItem.Attributes.Add("color", "Red;");
      }
  }
  </code></pre>
  
  <p>The above does not work. But I don't think that is the issue. After inspecting the element (before the above implementation) the style color property is already set to red. Do these just not apply to the currently selected item? </p>
  
  <p>I was able to set the text color of the entire list by setting the forecolor. But I can't set a single element's forecolor.</p>