I want to dynamically call the method of a custom class much like the below javascript. Except, the javascript below only calls a function that exists in my code. I want to call (dynamically) the function of a class. So I would remove window{value](target, event, self); and use something else that would call the method of a custom created class such as "mycustomclass.anythingcouldbethismethod(target, event, self);" after it had been instantiated of course.
var functions = [
                 'ajaxify_overlay',
                 'ajaxify_overlayCancel',
                 'ajaxify_overlaySubmit',
                 'ajaxify_rollout',
                 'ajaxify_rolloutCancel',
                 'ajaxify_rolloutSubmit',
                 'ajaxify_upload',
                 'ajaxify_contentArea',
                 'ajaxify_itemToggler',
                 'ajaxify_closer',
                 'ajaxify_submit',
                 'ajaxify_inputActivate',
                 'ajaxify_executeAndRefresh',
                 'ajaxify_empty' 
               ];
$(document).bind('ready', function(event) {   
  $('body').live('click', function (event){   
   var target = $(event.target);
   var self = this;  
   $.each(functions, function(index, value){
     if($(target).hasClass(value)) {
       window[value](target, event, self);
     }
          });    
       });
});
                var myClass = { /* your class definition */ };
var methodName = 'myMethod';
myClass[methodName](p1,p2,...,pN);
                        You mean like this?
function methodCaller( methodName, target, event, self ) {
    mycustomclass[ methodName ](target, event, self);
}
methodCaller( "someMethodName" );
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With