charlie
charlie

Reputation: 481

JQuery change text displayed after 5 seconds, twice

I am calling this function to show a loading popup window:

LoadModalBody('<h2 align="center">Loading...</h3><p align="center"><i class="fa fa-spinner fa-spin fa-5x"></i></p>');

the function itself, basically creates a div element and displays the data inside the div

When I call the function, I want to be able to change the Loading... text after 5 seconds, and then change it again after another 5 seconds.

Is this possible to do outside of the function?

Upvotes: 0

Views: 674

Answers (1)

Frederick Behrends
Frederick Behrends

Reputation: 3095

LoadModalBody('<h2 id="headingLoading" align="center">Loading...</h3><p align="center"><i class="fa fa-spinner fa-spin fa-5x"></i></p>');

setTimeout(function(){
    document.getElementById('headingLoading').innerHtml = 'New Text 1';
    setTimeout(function(){
        document.getElementById('headingLoading').innerHtml = 'New Text 2';
    }, 5000);
}, 5000);

Upvotes: 1

Related Questions