title: video.js ended event
body: <p>Why this throws up this error:</p>
  
  <blockquote>
    <p>The element or ID supplied is not valid. (VideoJS)</p>
  </blockquote>
  
  <p>I know it may be obvious but there's the code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   var videoPlayer = _V_("example_video_1", {}, function(){
  this.addEvent("ended", function(){ 
     alert('Here I am');
    });
  });        
  &lt;/script&gt;
  </code></pre>
  
  <p>and video ID set via PHP</p>
  
  <pre><code>&lt;?PHP
    echo "&lt;video id=\"example_video_1\" class=\"video-js vjs-default-skin\"  controls width=\"".$vid_h."\" height=\"".$vid_w."\" autoplay preload=\"auto\" data-setup='{}'&gt;";
  ?&gt;
  </code></pre>