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

176
Vistas
onEvent inside of a loop - Javascript

I've been trying to run this loop with onEvents inside of it, but it doesn't seem to work. I can click the button and everything works, the inner while loop keeps repeating until an onEvent is triggered, but none of the onEvents get triggered when I click on them.

onEvent("startBtn", "click", function() {
  setScreen("songScreen");
  setText("songName1", "Song name: " + trackName[0]);
  setText("artistName1", "Artist name: " + artistName[0]);
  setText("pos1", "Song position: " + songPos[0]);
  setText("pop1", "Song popularity: " + songPop[0]);
  while (i < songPos.length) {
    setText("songName1", "Song name: " + trackName[i]);
    setText("artistName1", "Artist name: " + artistName[i]);
    setText("pos1", "Song position: " + songPos[i]);
    setText("pop1", "Song popularity: " + songPop[i]);
    upClick();
    downClick();

  }

});

function upClick() {
  onEvent("upImg", "click", function() {
    songLiked = true;
    console.log("test up");
    i++;
  });
}

function downClick() {
  onEvent("downImg", "click", function() {
    songLiked = false;
    console.log("test down");
    i++;
  });
}

What am i doing wrong?

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