I want to set the cursor style to 'wait' while a lengthy javascript function is running, and then reset back to normal afterwards.
I thought this might be enough:
document.body.style.cursor = 'wait';
// long scripting here
document.body.style.cursor = 'auto';
However .. if I move the cursor to point at (e.g.) an <input>
then the cursor changes to the appropriate type e.g. 'text'. (Tested via individual commands in the console).
I did find this similar question, which sets up a css rule of
html.wait, html.wait * { cursor: wait !important; }
and uses that via this js:
document.querySelector("html").classList.add("wait");
// long scripting here
document.querySelector("html").classList.remove("wait");
.. but .. it doesn't seem to kick in while the script is running.