jQuery change cursor on click on link

14,509

Solution 1

you want only wait cursor on your link? so why select body and change cursor?!

$('a').css('cursor','wait');

Solution 2

Example

http://jsfiddle.net/loktar/3WLGt/4/

JS

jQuery(document).ready(function(){
  jQuery('a.cursor_wait').click(function(){
    jQuery('body').css('cursor', 'wait');
      jQuery(this).css('cursor', 'wait');
  });
});

Changes the property of the current link to the wait cursor as well, because by default they are set to pointer.

Share:
14,509
astropanic
Author by

astropanic

Take me home to paradise city where the build is green and the code is pretty...

Updated on June 04, 2022

Comments

  • astropanic
    astropanic almost 2 years

    How I can change the cursor CSS property of a link element, so when the user click on that link, the cursor switches from pointer to wait?

    jQuery(document).ready(function(){
      jQuery('a.cursor_wait').click(function(){
        jQuery('body').css('cursor', 'wait');
      });
    });
    

    This works, but I must move with the mouse from the link to see the wait indicator, when I leave my cursor on the link, I still see the pointer.

    How can I make this work without moving my cursor?

  • Alba Mendez
    Alba Mendez over 11 years
    Chromium, trunk: still doesn't work without moving the cursor.