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