In PHP it is possible to chain a method dynamically using a variable. For example:
$foo = 'myFunction';
return $this->{$foo};
I was wondering if a similar possibility exists in jQuery and/or Javascript. So for example:
$('body').on('keyup', '[function-attribute=myFunction]', function(){
var foo = $(this).attr('function-attribute');
return {foo}();
});
I understand the code above does not work but just hopefully gives an impression of what I'm trying to achieve.