Cursor not returning to its default State

I want to show busy cursor while downloading. and its working as expected but after click event ends still cursor showing busy. I want to roll back to its default after download completed i.e. after click events ended.

on Page load :

btnGenerate.Attributes.Add("onclick", "waitdownload();");

Aspx :

<script>
   function waitdownload() {
       document.body.style.cursor = "wait";
   }
</script>

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You could use a Timeout that waits x second to execute another piece of code.

<script>
    function waitdownload() {
        document.body.style.cursor = "wait";

        //wait 5 seconds to set the cursor to default
        setTimeout(function () {
            document.body.style.cursor = "default";
        }, 5000);
    }
</script>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x