title: jQuery add video on link click
body: <p>I am attempting to write a jQuery script where whenever a link is clicked on a certain page, a video is appended to the body, the video plays, and THEN it goes to the link's intended target.</p>
  
  <p>So far, this is what I have:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;body&gt;
  &lt;div id="videoHolder"&gt;
  &lt;a href="http://www.google.com"&gt;Google, as an example&lt;/a&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>jQuery</p>
  
  <pre><code>window.onbeforeunload=function(event) {
  $("#videoHolder").html(
  '&lt;video width="600" height="600" autoplay="autoplay"&gt;' +
      '&lt;source src="images/doors.mp4" type="video/mp4"&gt;&lt;/source&gt;' +
       '&lt;/video&gt;');
      setTimeout('window.location.href=' + $('a').attr(href), 5000);
  }
  </code></pre>