Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

109
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda