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

181
Views
jQuery: ¿cómo seleccionar el elemento de la lista desplegable por texto?

¿Cómo seleccionaría el elemento de mi lista desplegable por texto en lugar de valor?

Quiero seleccionar un elemento desplegable por texto con jQuery.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

uso : contiene () (enlace)

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

manifestación

over 4 years ago · Santiago Trujillo Report

0

Hay una función de filtro en jQuery que puede usar para obtener elementos con algo más específico

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

Esto devolverá todas las opciones con "text_to_select" en el texto.

over 4 years ago · Santiago Trujillo Report

0

Creo que esto te servirá...

 $("#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 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!