Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
jQuery - How to select dropdown list item by text?

How would I select my dropdown list item by text rather than value?

I want to select a dropdown item by text with jQuery.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

use :contains()(link)

$("select option:contains(text)").attr('selected', true);

demo

over 4 years ago · Santiago Trujillo Denunciar

0

There is a filter function on jQuery that you can use to get elements with something more specific

$("select option").filter(function() {
    return $(this).text() == "text_to_select";
});

This is going to return all options with the "text_to_select" in the text.

over 4 years ago · Santiago Trujillo Denunciar

0

i think this will do the trick for you...

$("#selectId").find("option:contains('text')").each(function(){
  if( $(this).text() == 'Text that should be matched' ) {
    $(this).attr("selected","selected");
  }
});
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda