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

134
Views
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 answers
Answer question

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 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!