Categories
JavaScript Answers

How to change cursor to waiting in JavaScript?

Spread the love

To change cursor to waiting in JavaScript, we set the body’s cursor style.

For instance, we write

document.body.style.cursor = "wait";

to set the body element’s cursor to 'wait' to show the loading the cursor.

Then we write

document.body.style.cursor = "default";

to set the body element’s cursor to 'default' to show the default cursor.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *