Could someone kindly point out where I went wrong? I am attempting to create an MP3 player using CSS, HTML, and JavaScript. Currently, the script only functions to start or stop the audio file. However, I keep encountering an error message: TypeError: document.getElementById(...) is null; Unfortunately, I'm unsure why this is happening. Thank you for any assistance!
Script:
<html>
<head>
<meta charset="utf-8" />
<title>Audio Player</title>
</head>
<body>
<script type="text/javascript">
var audio = document.getElementById('#listen');
document.getElementById('#control').addEventListener("click", function() {
if(audio.paused) {
audio.play();
} else {
audio.pause();
}
})
</script>
<audio id="listen" src="song.mp3">
ERROR
</audio>
<button id="control">Control</button>
</body>
</html>