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

73
Vistas
Set a default value and reload to current value

Please I need help on this. I'm still struggling with JavaScript. I wrote a function for price change and percentage change which is working fine. The price and percentage change is been fetched by an api.

I want to be able reload the price and percentage change without reloading the entire page and on reload, I want a default value to be displayed until it's current value is updated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here's how you would display a placeholder until your fetch is complete. I used setTimeout to simulate your fetch call. I'm not sure if your question was also about how to do the fetch, but here is the MDN article on it:

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

div = document.getElementById("some-id");
window.setTimeout(function() {
  div.innerHTML = "New Value";
}, 3000);
div.innerHTML = "Temp Value";
<div id="some-id"></div>

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