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

96
Views
Cambiar el color solo de parte de la etiqueta de la lista de selección HTML

Quiero hacer una lista de selección con dos colores diferentes en la etiqueta, así:

el numero esta en azul, y por pagina en color verde

ingrese la descripción de la imagen aquí

Mi código HTML simple es:

 <select> <option value="50">50</option> <option value="100">100</option> <option value="150">150</option> <option value="200">200</option> </select>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Como dicen los demás, necesitaría usar una selección personalizada, aquí hay un ejemplo muy básico

 $("ul").on("click", ".init", function() { $(this).closest("ul").children('li:not(.init)').toggle(); }); var allOptions = $("ul").children('li:not(.init)'); $("ul").on("click", "li:not(.init)", function() { allOptions.removeClass('selected'); $(this).addClass('selected'); $("ul").children('.init').html($(this).html()); allOptions.toggle(); });
 body{ padding:30px; } ul { color: blue; height: 30px; width: 150px; border: 1px #ffff solid; } .init { color: green; } ul li { padding: 5px 10px; z-index: 2; } ul li:not(.init) { float: left; width: 130px; display: none; background: #ddd; color: blue;} ul li:not(.init):hover, ul li.selected:not(.init) { background: #09f; color: blue; } li.init { cursor: pointer; color: blue;} a#submit { z-index: 1; }
 <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <ul class="list-unstyled"> <li class="init">[SELECT]</li> <li data-value="value 1">Option 1</li> <li data-value="value 2">Option 2</li> <li data-value="value 3">Option 3</li> </ul>

espero que esto ayude.

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!