Play a JavaScript sound file without a delay

Try using the native HTML5 Audio API. First, create the instances of the sounds you will need:

var ping = new Audio("ping.ogg");

Note: You do not need to insert these audio instances into the DOM at any point.

When you're ready to play the sound, e.g. when someone clicks:

document.querySelector(".ping").addEventListener("click", function() {

    // ping clicked, play ping sound:
    ping.play()
})

Because the ping instance is pre-loaded there should be no delay in playing the sound, and you can play it as many times as you like.

Keep in mind that codec support is not consistent cross-browser, so you will have to have an ogg source and an MP3 source, or another combination (support tables can be found here http://en.wikipedia.org/wiki/HTML5_Audio#.3CAudio.3E_element_format_support).

If you want a more backwards-compatible approach I recommend SoundManager2 as a complete solution with an easy API: http://www.schillmania.com/projects/soundmanager2/

Otherwise, the documentation for the native HTML5 Audio API can be found here: https://developer.mozilla.org/en-US/docs/HTML/Element/audio and here https://developer.mozilla.org/en-US/docs/DOM/HTMLAudioElement