Skip to content

Instantly share code, notes, and snippets.

@tevashov
Last active October 27, 2022 21:52
Show Gist options
  • Select an option

  • Save tevashov/5172442 to your computer and use it in GitHub Desktop.

Select an option

Save tevashov/5172442 to your computer and use it in GitHub Desktop.
How to use callbacks in jQuery #jQuery
function runAlertNow () {
$(this).html('I just ran this function!');
}
// both of these lines do the same thing
$('#test').slideUp(400, runAlertNow);
$('#test').slideUp(400, function ()
{
$(this).html('I just ran the anonymous function!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment