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