title: Javascript All audio fade out
body: <p>I want to fade out all playing audio. I tried <em>getElementsByTagName</em> but it seemed not working with audio volume. I have several audios and I named id as numbers. Check my HTML and JS code.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;input type="text" size="3" value="1" id="numtext" style="font-size:700pt" &gt;
  
  &lt;audio id=1&gt;
      &lt;source src=BGM/a.mp3&gt;
  &lt;/audio&gt;
  
  &lt;audio id=2&gt;
      &lt;source src=BGM/b.mp3&gt;
  &lt;/audio&gt;
  
  &lt;audio id=3&gt;
      &lt;source src=BGM/c.mp3&gt;
  &lt;/audio&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>    function fade() {
  
          var x = document.getElementById('numtext').value;
          var sounds = document.getElementById(x);
  
          var newVolume = (sounds.volume) - 0.07;
  
          // Check if the newVolume is greater than zero
          if(newVolume &gt;= 0){
              sounds.volume = newVolume;
          }
          else{
              // Stop fade
          sounds.pause();
          sounds.currentTime = 0;
          sounds.volume = 1;
  
              clearInterval(interval);
          }
  
  }
  </code></pre>
  
  <p>Any tips are welcome.</p>