Reputation: 47
A very basic question:
$(element).fadeOut("slow",myFunction());
This doesn't work. What is the correct way to do it?
Upvotes: 0
Views: 72
Reputation: 12127
Try this way
$(element).fadeOut("slow", function(){
myFunction();
});
Upvotes: 0
Reputation: 10226
Try
$(element).fadeOut("slow", myFunction);
Your code, i.e. adding ()
would actually run the code rather than defining it as callback.
Just some quick console playing:
function test() {}
typeof test // "function"
typeof test() // "undefined"
So the argument needs to be a function and not what a function returns (except that would be function, too).
Upvotes: 3