$('.btn').click(function() { var audio = new Audio("sounds/" + $(this).attr('id') + ".mp3"); audio.play(); });