Would somebody be so kind to tell me what I did wrong? I want to create a mp3-player with css, html and javascript. The only thing the script does at the moment is to start or to stop the audio-file. The problem is, that I always get an error.: TypeError: document.getElementById(...) is null; But I don't know why. Thank you very much for your help!!!
Script:
<html>
<head>
<meta charset="utf-8" />
<title>Video | Audio</title>
</head>
<body>
<script type="text/javascript">
var hear = document.getElementById('#listen');
document.getElementById('#control').addEventListener("click", function() {
if(hear.paused) {
hear.play();
} else {
hear.pause();
}
})
</script>
<audio id="listen" src="song.mp3">
ERROR
</audio>
<button id="control">control</button>
</body>
</html>