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

228
Views
Obtenga el valor actual seleccionado en el menú desplegable usando jQuery

Tengo un conjunto de cuadros desplegables generados dinámicamente en mi página. básicamente los clono usando jQuery. ahora quiero capturar el valor seleccionado en cada menú desplegable en el evento de cambio.

Intenté algo como esto que no funcionó.

 $('._someDropDown').live('change', function(e) { //debugger; var v = $(this); alert($(this + ':selected').val()); alert($(this).val()); });

¿Cómo lo hago?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Para obtener el texto de la opción seleccionada

 $("#your_select :selected").text();

Para obtener el valor de la opción seleccionada

 $("#your_select").val();
over 4 years ago · Santiago Trujillo Report

0

Esto es lo que necesitas :)

 $('._someDropDown').live('change', function(e) { console.log(e.target.options[e.target.selectedIndex].text); });

Para el nuevo uso de jQuery on

 $(document).on('change', '._someDropDown', function(e) { console.log(this.options[e.target.selectedIndex].text); });
over 4 years ago · Santiago Trujillo Report

0

$("#citiesList").change(function() { alert($("#citiesList option:selected").text()); alert($("#citiesList option:selected").val()); });

citiesList es la identificación de la etiqueta seleccionada

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!