title: How to call onended event for videos created when the popup is loaded
body: <p>I am creating a video element onload event of a particular popup, is there a way i can call the <strong>onended</strong> event for the created video when the video ends.</p>
  
  <p>my code for creating video element onload is as follows</p>
  
  <p>Dynamic code</p>
  
  <pre><code>require ("connect.php");
  
      $query = "SELECT * FROM videos";
      $result = mysql_query($query);
      $numrows = mysql_num_rows($result);
      if ($numrows &gt; 0) {
  
          $video_div = 0;
          $hide = 0;
  
  
  
          while ($row = mysql_fetch_array($result)) {
  
              $video_id = $row['id'];
  
              $url = $row['url'];
  
              $url_value = "video.php?name=" . $url;
              $filename = $row['name'];
              $user_type = $row['usertype'];
              $url = array($url);
              if ($user_type == 0) {
                  $user_category = "Prospective User";
              }
              if ($user_type == 1) {
                  $user_category = "Admin User";
              }
              if ($user_type == 2) {
                  $user_category = "Actual Customer";
              }
  
  
              $video_div = $video_div + 1;
              $video_dive = "video_div" . $video_div;
  
  
              //click event to load colorbox
              echo '&lt;a  class="inline" href="#'. $video_dive.'"  id="'.$url_value.'"&gt;
              &lt;img src="images/thumbnail.jpg" width="50" height="50"   &gt; 
              &lt;/a&gt;';
              //div to show vide element through jquery
              echo '&lt;div id="' . $video_dive . '"    &gt; &lt;/div&gt;';
  
         }
  } else {
          echo "There are no uploaded videos";
      }
  </code></pre>
  
  <p>javascript code</p>
  
  <pre><code>$(document).ready(function() {
  
  $(".inline", this).colorbox({
  
              inline : true,
  
              width : '650px',
              //load function that opens the popup
              onLoad : function() {
  
                  href_value = $(this).attr("href");
                  id_value = $(this).attr("id");
  
                  techi = {
                      "techOrder" : ["flash", "html5"]
                  };
  
                  //to reder video element insid the div
                  $(href_value).html('&lt;video id="player" data-my_videoid="1"   class="videocall video-js vjs-default-skin vjs-big-play-centered"  preload="auto" poster="images/video_img.png" width="640" height="360" controls data-setup="' + techi + '"&gt;&lt;source src="' + id_value + '" type="video/mp4"  /&gt; &lt;p class="vjs-no-js"&gt;To view the video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video&lt;/p&gt; &lt;/video&gt;');
  
                  var myPlayer = videojs('player');
                  myPlayer.load();
                  $(href_value).show();
  
              }
  });
  }):
  </code></pre>
  
  <p>I am creating the video element on load event of a popup dynamically</p>
  
  <p>The above is called onLoad event of a popup ,  onended event must be fired once the video has ended </p>
  
  <p>Is there a way to trigger onend event while the video has ended</p>
  
  <p>I would like to set the ended event but i have no idea how to trigger the event since i am creating the video element at the time of opening the colorbox popup using jquery</p>
  
  <p>Thanks</p>