I am trying to play a sound in Safari on a special event. This is what I am doing
<html>
<head>
<in a js file>
if(event)
document.getElementById('sound').play();
</in a js file>
</head>
<body>
<audio id="sound" src="pling.mp3"></audio>
</body>
</html>
The sound pling.mp3 is in the the same folder as the html file.
The result in Safari developer console is: TypeError: Result of expression 'document.getElementById('sound').play' [undefined] is not a function.
What am I doing wrong? Isn't this the way it is supposed to work?