0
Why does this eŕror occurs ?
Hello can you help me ? I don't understand what's wrong, it writres "Cannot read property addEventListener of null" https://code.sololearn.com/W5TKLRB03i55/?ref=app
4 Réponses
+ 1
It's because t1 in the starting points to the Audio object
And in the end you use the same variable to point to the rect element
So change the variable name
0
Just wrap your method with a function of onload event
onload = function(){
var t = document.querySelector('rect');
t.addEventListener('click', function(){
t1.play();
});
}
0
Ok thanks but now it does not read my function "t1.play is not a function"
0
Thanks it works :)