Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
How to show the option with a value=0 with red background using CSS and/or jQuery, no matter if it is selected or not?

I have tried simple CSS solutions, as well as a combination of both CSS and jQuery. The problem is that they show the option with the 0 value in red only when it is not selected.

.red {
  background: red;
}

select option[value=0] {
  background: red;
}
<select id="ups">
  <option value=0 class="red" selected="selected">No</option>
  <option value=1>Yes</option>
</select>

I have already conducted extensive search, so please any help is appreciated. Thanks.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I guess it depends on the browser, on firefox I can't see anything with red background, even not selected.

There is a similar question here: How to style the option of an html "select" element?

People linked this: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_custom_select

I don't think done in this way that can work for only one of the options. Yet you can make it when one is selected('No' for example) background for the whole thing to go red. Not perfect, but as close as possible I think that will work on most popular browsers.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!