Posted By

verhaeg on 08/04/10


Tagged

ajax javascript action jquery cursor


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

verhaeg
kspal


Change cursor and prevent click on AJAX request


 / Published in: jQuery
 

I found this really useful when using AJAX that will change database. Preventing the user to re-do the action is not the best way but it still is a little unobtrusive to the user as it lets him navigate the page and know what is going on.

  1. $('html').ajaxStart(function(){
  2. $(this).addClass('wait').bind('click',function(){
  3. return false;
  4. });
  5. }).ajaxStop(function(){
  6. $(this).removeClass('wait').unbind('click');
  7. });
  8.  
  9. //On the CSS
  10. html.wait, html.wait * {cursor:wait;}

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: verhaeg on August 4, 2010

Just a sorry: forgot to add the comma between the CSS statement. Should be: html.wait, html.wait * {cursor:wait;}

You need to login to post a comment.