When the button is clicked, I want the spiners to appear for 3 seconds and then disappear. i can make
visible but cant make invisible again
function stoploading() {
document.getElementById('loading').style.visibility = 'visible';
}
<button class="btn btn-danger d-inline-flex align-items-center" type="button">ATTACK</button>
<div class="col text-white m-5 px-5">
<div id="loading" class="spinner-border text-primary load_icon" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
2
Answers
So I created a
<button>
and a functionstartLoading()
that removes the "Loading…" after 3 seconds.you may apply hidden style to loading after 3 second
or you can also use classList.add(‘visible’); and classList.remove(‘visible’); to have same effects