title: Uncaught SyntaxError: Unexpected token %
body: <p>I have a page with multiple YouTube embedded players that I need to listen for events on. I am trying to use the solution posted as the answer to  <a href="https://stackoverflow.com/questions/786380/using-youtubes-javascript-api-with-jquery">Using Youtube&#39;s javascript API with jQuery</a>, but I am getting a strange error: (in Chrome 18.0.1025.137 beta-m)</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token %
  </code></pre>
  
  <p>That is the extent of the error, including stacktrace. My code is like this:</p>
  
  <pre><code>var onYouTubePlayerReady = function (id) {
  var evt = '(function(){})';
  
  alert(eval(evt)); //just to verify that the snippet is syntactically correct
  
  var ytplayer = document.getElementById(id);
  ytplayer.addEventListener("onStateChange", evt);
  };
  </code></pre>
  
  <p>(see the other question for more context)</p>
  
  <p>The error is thrown when the <code>onStateChange</code> event is fired. If I make <code>evt</code> <code>""</code> or a function name, then it doesn't throw the error (but I also get no state information).</p>
  
  <p>Clearly, the error message is bogus, but anyone know if what I'm trying to do is possible?</p>