Sometimes, we want to change cursor to waiting in JavaScript.
In this article, we’ll look at how to change cursor to waiting in JavaScript.
How to change cursor to waiting in JavaScript?
To change cursor to waiting in JavaScript, we can set the cursor
style.
For instance, we write
document.body.style.cursor = 'wait'
to change the cursor style to spinner.
And we set the cursor style back to the normal style with
document.body.style.cursor = 'default'
We set the style on the body element with both lines so we see the cursor no matter where the mouse is on the page.
Conclusion
To change cursor to waiting in JavaScript, we can set the cursor
style.