Here's an example of the HTML I'm working with:
<select onclick="colorchanger()">
<option name="white" value="0">--Select--</option>
<option name="red" value="1">Work</option>
<option name="green" value="2">Doesn't Work</option>
</select>
I am trying to change the color of the select box when an option is selected. While I know how to change the color based on the value, I specifically need to do it based on the name attribute. Could someone please provide guidance on how to achieve this functionality using JavaScript?