title: Mute all audio on page with Jquery
body: <p>I have a number of different audio elements in my page as part of a narrative site.  Each audio element has an ID so it can be called in at certain points. There is never more than one of the sounds playing at any time. But what I need is a mute button for the page as well and I can't use an id as far as I know because I need them to unmute back to the last sound rather than unmute them all (if that makes sense). Is there an easy way to mute all the page audio and then unmute again without triggering all audio to play?</p>
  
  <p>Below is my code but it doesn't work obviously and I'm not sure what the best way to do it would be:</p>
  
  <p>html:</p>
  
  <pre><code>    &lt;audio id="streetsound" preload="auto" autoplay loop&gt;
      &lt;source src="assets/audio/1street.mp3" type="audio/mpeg"&gt;
      &lt;/audio&gt;
  
      &lt;audio id="seasonsound" preload="auto" loop&gt;
      &lt;source src="assets/audio/2seasons.mp3" type="audio/mpeg"&gt;
      &lt;/audio&gt;
  
      &lt;audio id="snowsound" preload="auto" loop&gt;
      &lt;source src="assets/audio/3snow.mp3" type="audio/mpeg"&gt;
      &lt;/audio&gt;
  
  
   &lt;div id="soundicon" style="display: none;"&gt;
      &lt;a href="#" id="muteaudio"&gt;&lt;img src="assets/images/sound.png" alt="cup" style="border:0;"&gt;&lt;/a&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Jquery:</p>
  
  <pre><code>$(function(){
      $('#muteaudio').click(function() {
         $('audio').pause("");
  
      });
  });
  </code></pre>