title: JavaScript listen for jQuery event
body: <p>I'm having trouble passing an event from jQuery to JavaScript. I am setting the JS event listener first and then firing the jQuery event from an external file, but the listener never gets triggered. Here's some code:</p>
  <p><strong>Listener</strong></p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
  document.addEventListener('readyToPlay', loadLibs);
  
  function loadLibs() {
      alert('success');
  }
  
  &lt;/script&gt;
  &lt;script src=&quot;/assets/js/plugins/co/co.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p><strong>Included File</strong> - The alert returns (function), which means jQuery is loaded</p>
  <pre><code>function init() {
      alert(typeof jQuery);
      $(document).trigger('readyToPlay');
  }
  </code></pre>
  <p>I am thinking the issue might be caused by referencing document in the external file, but I'm not sure how to get around that.</p>