title: Passing a Javascript function through inline data- attributes
body: <p>I'm working with a Javascript file upload library, and one of it's features is that it uses HTML5 inline data- attributes to pass information to the plugin. </p>
  
  <p>This is working great for anything data related, strings, numbers etc., however the plugin has some callback methods you can assign function to. My problem is that when trying to pass a javascript function through these inline data attributes, like this:</p>
  
  <pre><code>&lt;input type="file" name="test" data-on-finish="alert();"&gt;
  </code></pre>
  
  <p>The plugin picks up the reference to the onFinish() callback method fine, but when it tries to execute whatever javascript I put in there I get the error:</p>
  
  <pre><code>Uncaught TypeError: Object alert(); has no method 'call' 
  </code></pre>
  
  <p>I'm assuming it's reading the <code>alert();</code> as a string. Any idea how I can pass through executable javascript to the plugin?</p>
  
  <p>I believe the plugin I'm using is an extension to the jQuery file upload plugin:
  <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Options" rel="noreferrer">https://github.com/blueimp/jQuery-File-Upload/wiki/Options</a></p>
  
  <p><strong>Update:</strong>
  I've also tried using globally defined functions, like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function myTesting(){
         alert('yay');
      }
  &lt;/script&gt;
  &lt;input type="file" name="test" data-on-finish="myTesting"&gt;
  </code></pre>
  
  <p>I've tried changing the <code>data-on-finish</code> attribute to <code>myTesting</code>, <code>myTesting()</code>, still had no luck...</p>