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

72
Views
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 answers
Answer question

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 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!