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

137
Vistas
Print next value of select in javascript

I have a <select> element with units of lengt in it. I have writen a javascript code, that should have printed the next value of the select, but it just sleects the next and prints the current one. var select = document.form.unit; var value = select.options[select.selectedIndex++].value; document.form.output.value = value;

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You have used post increment on selectedIndex. That's why variable value stores value of selected item. Modify your code to this:

var select = document.form.unit;
select.selectedIndex++;
var value = select.options[select.selectedIndex].value;
document.form.output.value = value;
about 4 years ago · Juan Pablo Isaza 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