javascript - Change background color of drop down menu on select -


How can the color of the drop down menu change as I have a drop down menu with 5 options, whenever I I click on an option, then I need an option to change that color, so that I can track what options I have already chosen. (5 is hypothetical here, there is a large list with IP and I can not remember so many fields as ports in the area).

Just assumes my drop down

     

  var = document.getElementById (select ' ); Select.onchange = function () {select.options [select.selectedIndex] .style.backgroundColor = 'red'; } Var clean = document.getElementById ('clear'); Clean.onclick = function () {for (var i = 0; i   
  & lt; Select ID = "Select" & gt; & Lt; Option val = "" & gt; Please select & lt; / Options & gt; & Lt; Option val = "1" & gt; Option 1 & lt; / Options & gt; & Lt; Option val = "2" & gt; Option 2 & lt; / Options & gt; & Lt; Option val = "3" & gt; Option 3 & lt; / Options & gt; & Lt; Option val = "4" & gt; Option 4 & lt; / Options & gt; & Lt; Option val = "5" & gt; Option 5 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Button type = "button" id = "clean" & gt; Clean & lt; / Div & gt;      

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -