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

74
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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