title: Toggle autoplay attribute on HTML5 videos
body: <p>I have some overlays on my website containing HTML5 videos. By default the overlays are not visible but they can be activated with clicking on certain images. </p>
  
  <p>When an overlay is inactive I’d like the HTML5 videos to be inactive too. That’s no big deal. When an overlay is active (it gets the class <code>active</code>) the containing videos should get the attribute <code>autostart</code>. When the overlay is closed again the <code>autostart</code>attribute should be removed from the videos.</p>
  
  <pre><code>// Check if there are videos who have a grandgrandparent with the class `.active`
  if ( $( 'video' ).parents( '.active' ).length ) {
  
      // Now I need the videos which suit this condition but I don’t know how
  
      // Add autoplay attribute to all these videos
      $( videos ).prop( 'autoplay', true );
  
  } else {
  
      // Remove the autoplay attribute from all videos when the parent doesn’t have the class active
      $( videos ).prop( 'autoplay', false );
  
  }
  </code></pre>