Combobox checking whether it is already selected or not

Asked

Viewed 48 times

0

Good afternoon I need help making a checkbox with the following function: if a value of the checkbox is already inserted it is red, and if any value is not inserted it is green.

So the following is my selectbox and what I need help with is that when selecting an option it turns red and the rest turns green, and then turns red when in this case it is for a barbershop, after the service is over the option turns green again

<select id="hora" name="hora"> 
    <option >Hora</option> 
    <option value="8:30" >8:30</option> 
    <option value="9:30">9:30</option> 
    <option value="10:30">10:30</option> 
    <option value="11:30">11:30</option> 
</select>
  • Enter the code of what you already have, HTML CSS JS, tell if it will usat jQuery or just JS. Your question needs to be more complete.

  • So the following is my selectbox and what I need help with is that when selecting an option this option turns red and the rest turns green <select id="time" name="time"> <option >Time</option> <option value="8:30" >8:30</option> <option value="9:30">9:30</option> <option value="10:30">10:30</option> <option value="11:30">11:30</option> </select>

  • André edits his answer with the code that is best.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.