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

133
Vistas
Variable that becomes undefined in an onload

I am distributing my images converted to base64 and then crop them, but when I run the function my variablechosenImage, she goes undefined in the onload but is well defined just before (observation made thanks to the debugger). Would you have a solution to solve my problem? I've already tried passing the variable to var to make it global, but no effect. Here is my code :

let reader = new FileReader();
let uploadButton = document.getElementById("upload-button");
file_recup = document.getElementById("upload-button").value;
var chosenImage = document.getElementById("img_crop_1");
reader.readAsDataURL(uploadButton.files[0]);
reader.onload = () => {
   chosenImage.src = reader.result;  
}
about 4 years ago · Santiago Gelvez
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