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.