Skip to content Skip to sidebar Skip to footer

Manually Call A Function In Javascript?

How do you do this? like PHP has call_user_func I'm trying to pass a callback function to jQuery.animate(), like this ... complete: function(){ // do_something call_function(

Solution 1:

You can simply call it like you would any function

my_callback();

JavaScript also has a call method that some people prefer

 my_callback.call();

Here's a link I found with some extra information regarding the call method. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/Call

Post a Comment for "Manually Call A Function In Javascript?"