JavaScript Cursor Change (and change back again)

前端 未结 7 1995
日久生厌
日久生厌 2021-01-17 11:14

I have this page that does some funky database stuff that takes a couple seconds to process, and in the meantime I\'d like to set a \"wait\" cursor so the user

7条回答
  •  孤街浪徒
    2021-01-17 11:51

    Any elements that don't inherit the cursor by default (such as buttons) will need to set the cursor to inherit:

    someButton.style.cursor = 'inherit';
    

    To go back to the default for an element (and not break things like :hover with a forced cursor), set it to an empty string:

    document.body.style.cursor = '';
    

提交回复
热议问题