Using callbacks in jQuery


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function runAlertNow ()
  2. {
  3. $(this).html('I just ran this function!');
  4. }
  5.  
  6. // both of these lines do the same thing
  7. $('#test').slideUp(400, runAlertNow);
  8. $('#test').slideUp(400, function ()
  9. {
  10. $(this).html('I just ran the anonymous function!');
  11. });
  12.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.