Q:

jquery find not working to find audio and video tag pause and play audio

Iam using attribute selector to find the active slide and pause if there are any audio or video tags in the active slide. but it seems iam doing something wrong. Can anyone help me out.
The console is showing this error s.find is not a function
Here is the below code.
jQuery("#Pause").bind('click', function()
{
     var s = jQuery("section[aria-selected=true]");
     var video   =   s.find("video");
     var audio   =   s.find("audio");

     if (video.length)
     {
          video.pause();
     }

     if (audio.length)
     {
          audio.pause();
     }
});

And below is the HTML code
    <a href="javascript:void(0);" id="Pause">Pause</a>
<a href="javascript:void(0);" id="Play">Play</a>

<section aria-selected="true">
    <h1>My Presentation</h1>
    <footer>by John Doe</footer>
</section>

<section>
        <audio controls>
            <source src="traffic.ogg" type="audio/ogg" />
            <source src="traffic.mp3" type="audio/mpeg" />
        </audio>
</section>

<section>
    <h3>An incremental list</h3>
    <ul class="incremental">
      <li>Item 1
      <li>Item 2
      <li>Item 3
        <ul class="incremental">
          <li> Item 3.1
          <li> Item 3.2
        </ul>
    </ul>
    <div role="note">Some notes. They are only visible using onstage shell.</div>
</section>

<section>
  <blockquote>
    Who's brave enough to fly into something we all keep calling a death sphere?
  </blockquote>
  <details>
    <p>In the onstage shell, notes scroll rather than overflow:</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac dui eu est feugiat lacinia sit amet nec leo. Mauris eu ipsum leo. Nulla mi odio, cursus sed sollicitudin non, fringilla id magna. Suspendisse sit amet posuere elit. Maecenas iaculis, turpis a placerat imperdiet, libero lorem feugiat nisi, nec tincidunt diam nibh sit amet massa. Vestibulum quis adipiscing tellus. Maecenas sollicitudin sodales pulvinar. Donec dui ipsum, bibendum facilisis consequat interdum, tempus ut mauris. Aliquam ut dolor nec odio scelerisque bibendum quis in neque. Aliquam dui dui, pulvinar quis fermentum quis, gravida eu augue. Nunc tristique dolor a urna pulvinar bibendum. Curabitur mollis cursus neque, in scelerisque metus porta non. Donec tempor enim in nibh vestibulum et convallis nisi malesuada. Duis ut lectus sed metus venenatis porttitor id pharetra quam. Suspendisse sapien turpis, ornare in molestie et, gravida eget turpis.
    </p>
  </details>
</section>

A:

You are not executing this code when the document is ready. Your code find audio and video tags just fine if run when the document is ready.
If you don't your code execute before the elements are on the document so s would return a jQuery instance but one without any elements which is probably why find() was not available.
Created a demo so it fixes the jquery instance issue I was referring when trying to call pause() on my first comment, updated the HTML so the selected one has an audio file and added a proper file to stream so playing and pausing from your custom button can be tested.
http://jsfiddle.net/u9E3N/2/
In jQuery you execute code when the document is ready like this
$(document).ready(function() {
  // code goes here
});

or for short
$(function() {
  // code goes here
});

