I've just taken my first steps into learning Javascript.
I'd like to us console log to find the children of my playToggle button but I'm getting Uncaught TypeError: Cannot read properties of null (reading 'addEventListener'). Please help me learn what I am doing wrong, I was under the impression that I had given playToggle a value.
const playToggle = document.getElementById('music-
player');
function changeIcon(){
console.log(playToggle.children);
}
playToggle.addEventListener('click', changeIcon);
HTML:
<div class="theme-switch-wrapper">
<span id="music-player">some text</span>
<i id="playBtn" class="fa-solid fa-circle-play"></i>
<i id="pauseBtn" class="fa-regular fa-circle-pause"></i>
</span>
</div>
