title: Force html5 video to stop on jquery tab change
body: <p>I was under the impression if I specified #tabs it would find the video since it appears video is a standard tag declarative. I am not completely sure if I am calling out the wrong tag or what is happening. I am using the JQuery tabs and video-js code to power this function. I'm thinking if a user starts watching a video and wants to come back to it by visiting another tab, the video in the unselected tab should stop. But I'm not exactly sure how to get this working, please help. Here is my code, maybe someone can tell me what I'm doing wrong?</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;link href="http://vjs.zencdn.net/5.18.4/video-js.css" rel="stylesheet"&gt;
    &lt;!-- If you'd like to support IE8 --&gt;
    &lt;script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"&gt;&lt;/script&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;title&gt;Video Library&lt;/title&gt;
    &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
    &lt;link rel="stylesheet" href="/resources/demos/style.css"&gt;
    &lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
    &lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
    &lt;script&gt;
    $( function() {
      $( "#tabs" ).tabs();
    } );
    $('#tabs').on('click', function() {
    $("my-video").each(function () { this.pause() });
  });
    &lt;/script&gt;
    &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="tabs"&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#tabs-1"&gt;About us&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-2"&gt;Features&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-3"&gt;Fabrics&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-4"&gt;Special Fabrics&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-5"&gt;Standard Fabrics&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-6"&gt;Care Instructions&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-7"&gt;How It's Made&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#tabs-8"&gt;Women's Coats&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
    &lt;div id="tabs-1"&gt;&lt;br&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/about_factory.jpg" data-setup="{}"&gt;
      &lt;source src="sources/about-our-factory.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
      &lt;div id="tabs-2"&gt;
      &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/coat_features.jpg" data-setup="{}"&gt;
      &lt;source src="sources/coat-features-coat-profile.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;&lt;/div&gt;
    &lt;div id="tabs-3"&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/fabrics.jpg" data-setup="{}"&gt;
      &lt;source src="sources/cotton-fabrics.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
    &lt;div id="tabs-4"&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/specialty_fabrics.jpg" data-setup="{}"&gt;
      &lt;source src="sources/specialty-fabrics.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
    &lt;div id="tabs-5"&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/coat_fabrics.jpg" data-setup="{}"&gt;
      &lt;source src="sources/fabrics.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
    &lt;div id="tabs-6"&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/care_instructions.jpg" data-setup="{}"&gt;
      &lt;source src="sources/how-to-care-for-your-lab-coat.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
    &lt;div id="tabs-7"&gt;
      &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/how_its_made.jpg" data-setup="{}"&gt;
      &lt;source src="sources/how-we-make-your-lab-coat.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;/div&gt;
    &lt;div id="tabs-8"&gt;
    &lt;video id="my-video" class="video-js" controls preload="auto" width="640" height="264"
    poster="imgs/womens_coats.jpg" data-setup="{}"&gt;
      &lt;source src="sources/womens-coats.mp4" type='video/mp4'&gt;
      &lt;p class="vjs-no-js"&gt;
        To view this video please enable JavaScript, and consider upgrading to a web browser that
        &lt;a href="http://videojs.com/html5-video-support/" target="_blank"&gt;supports HTML5 video&lt;/a&gt;
      &lt;/p&gt;
    &lt;/video&gt;
    &lt;script src="http://vjs.zencdn.net/5.18.4/video.js"&gt;&lt;/script&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>