title: script.js:12 Uncaught TypeError: Cannot read property 'currentTime' of null
body: <p>I am doing a music player on js and i need to do a slider so the user can navigate in the audio</p>
  <p>Here is my code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function slider_container() {
    const audio = document.getElementById('audio');
    const time = audio.currentTime;
    const time_max = audio.duration;
  
    document.getElementById('current_time').innerHTML = "" + time_max + "";
  }
  slider_container();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="slider_container"&gt;
    &lt;div class="current-time" id="current_time"&gt;00:00&lt;/div&gt;
    &lt;input type="range" min="1" max="100" value="0" class="seek_slider" onchange="seekTo()"&gt;
    &lt;div class="total-duration"&gt;00:00&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;audio src="Audio/free.mp3" id="audio" autoplay="autoplay"&gt;
  
          &lt;/audio&gt;</code></pre>
  </div>
  </div>
  </p>