There are a few reasons your code isn't working as expected. First, modern browsers block autoplay for audio to prevent annoying users. Second, your JavaScript is looking for an ID (audio) that isn't actually assigned to your tag. Here is the fixed version. I've added a button, because browsers require a user interaction (like a click) before they allow audio to play. The Fixed Code HTML