So the HTML is as easy 1, 2, 3 And the JS magic behind it: for(var i = 1; i <= 3; i++) { document.querySelector("#song" + i)[0].play(); }