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

101
Views
Valor de e.target.value sin definir

Tengo un let: valorImput, proveniente de un e.target.value de entrada. Uso este valor para compararlo con un valor en una matriz y funciona. Pero cuando quiero obtener su valor, dice indefinido y no puedo usarlo en funciones futuras. Este es un enlace a Codesand con el código completo.

 let valorImput = ""; dropDown.onchange = (e) => { valorImput = e.target.value; console.log("dropdown onchange console", e.target.value); }; btn.onclick = (e) => { const existe = productos.find((x) => x.titulo === valorImput); existe ? (precio = existe.precio) : console.log("NO hay Nada"); document.getElementById("valorDeSelect").value = precio; Swal.fire("El precio esta expresado en Dolares!", "USD " + precio, "success"); console.log("valor input", valorImput); };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La variable valorImput debe declararse en el ámbito global (fuera de los corchetes "{}").

jsfiddle

Consulte la documentación para obtener más detalles.

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!