I am using the following code:
<div class="loading-mask" id="loading-mask" style="display: none;">
<span>Authenticating</span>
</div>
<script type="text/javascript">
(function() {
document.getElementsByClassName('form')[0]
.addEventListener("submit", function () {
document.getElementById("loading-mask").style.display = "block";
}, false);
})();
</script>
What this does is to make a Div called loading-mask visible after a user clicks submit. How can I make it so that it also displays a period after the word "Authenticating" with more periods being added at the rate of one every five seconds?
You can use setInterval
function. More info: https://developer.mozilla.org/en-US/docs/Web/API/Window.setInterval
setInterval(function() {
document.getElementById('loading-mask').innerHTML += '.';
}, 5000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.