title: Cannot set property 'innerHTML' of null at HTMLAudioElement.<anonymous>
body: <p>error: Uncaught TypeError: Cannot set property 'innerHTML' of null at HTMLAudioElement. why am i geting this error, the minute nd seconds of the song is not working please what could be the solution</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>//list of all songs
  
  let allMusic = [{
      name: "Abeg",
      artist: "Uzikwendu ft Magnito, Zoro &amp; Slow Dogg",
      img: "music-1",
      src: "music-1"
    },
    {
      name: "Kilometer",
      artist: "Burna Boy",
      img: "music-2",
      src: "music-2"
    }
  ]
  
  
  const wrapper = document.querySelector('.wrapper')
  
  const ulTag = wrapper.querySelector('ul')
  
  for (let i = 0; i &lt; allMusic.length; i++) {
  
    const liTag = `&lt;li&gt;
              &lt;div class="row"&gt;
                  &lt;span&gt;${allMusic[i].artist}&lt;/span&gt;
                  &lt;p&gt;${allMusic[i].name}&lt;/p&gt;
              &lt;/div&gt;
              &lt;audio class="${allMusic[i].src}" src="musics/${allMusic[i].src}.mp3"&gt;&lt;/audio&gt;
              &lt;span id="${allMusic[i].src} class="audio-duration"&gt;3:50&lt;/span&gt;
              &lt;/li&gt;`
    ulTag.insertAdjacentHTML("beforeend", liTag)
  
    // let audioTag = 
    let liAudioDuration = ulTag.querySelector(`#${allMusic[i].src}`);
    let liAudioTag = ulTag.querySelector(`.${allMusic[i].src} `)
  
    liAudioTag.addEventListener('loadeddata', () =&gt; {
      // update audio song duration
      let audioDuration = liAudioTag.duration
      let totalMin = Math.floor(audioDuration / 60);
      let totalSec = Math.floor(audioDuration % 60);
      if (totalSec &lt; 10) {
        totalSec = `0${totalSec}`;
      }
      liAudioDuration.innerHTML = `${totalMin}:${totalSec}`;
    })
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;audio id="main-audio" src=""&gt;&lt;/audio&gt;</code></pre>
  </div>
  </div>
  </p>