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

107
Views
Select menu value undefined when called on in another function

I have a vanilla javascript file as i am trying to develop my vanilla js knowledge, I have this problem where I am calling another function when a button is clicked and this function should be passed the value from my select menu.

But if i load up my page and then click the button without touching the select menu it says the select menu value is undefined, even though i set a defaul selected option

does anyone know why this is?

here is my code snippets:

        <select name="cur" id="cur" onclick=getRate(document.getElementById('cur').value)>
            <option value="x">x</option>
            <option value="y" selected="selected">y</option>
            <option value="z">z</option>

function finalVal() {
  let symbolHome = getRate(document.getElementById('cur').value)[1];

I have checked getRate function and it returns values properly in an array of size 4 [x,y,z,a]

about 4 years ago · Juan Pablo Isaza
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!