You can use the syntax:
$('selector')[foo1]();
However, another approach to dynamically invoking a method is to create a new method that divides
(function() { $.fn.someFunc = function(what) { switch(what) { case 'fadeOut': $(this).fadeOut(); break;
This will allow you to quickly control what happens, instead of passing something like foo1.
Ben rowe
source share