JSFiddle - React, Tailwind, and code Playground
HTML
<select name="rating" id="2010">
<option class=white value="white">Choose From List</option>
<option class=green value="green">High</option>
<option class=yellow value="yellow">Medium</option>
<option class=orange value="orange">Low</option>
<option class=gray value="gray">N/A</option>
</select>
<select name="rating" id="2011">
<option class=white value="white">Choose From List</option>
<option class=green value="green">High</option>
<option class=yellow value="yellow">Medium</option>
<option class=orange value="orange">Low</option>
<option class=gray value="gray">N/A</option>
</select>
<select name="rating" id="2012">
<option class=white value="white">Choose From List</option>
<option class=green value="green">High</option>
<option class=yellow value="yellow">Medium</option>
<option class=orange value="orange">Low</option>
<option class=gray value="gray">N/A</option>
</select>
CSS
.green {
background-color: green;
}
.yellow {
background-color: yellow;
}
.orange {
background-color: orangered;
}
.gray {
background-color: gray;
}
.white {
background-color: white;
}
JavaScript
let selects = document.getElementsByName("rating");
for (let select of selects) {
let selected = localStorage.getItem(select.id);
if (selected) {
select.selectedIndex = selected;
select.className = select.value;
}
select.addEventListener("change", function() {
localStorage.setItem(this.id, this.selectedIndex);
this.className = this.value;
});
}