1

I have a link <a href="#" id="button">click</a> on my page and I want to play a notification or alert beep on click. how can I do this using jQuery??

Thanks in advance...:)

blasteralfred

Tim
  • 5,773
  • 3
  • 33
  • 62
Alfred
  • 20,303
  • 60
  • 160
  • 239
  • possible duplicate of [Cross-platform, cross-browser way to play sound from Javascript?](http://stackoverflow.com/questions/187098/cross-platform-cross-browser-way-to-play-sound-from-javascript) – kapa Apr 14 '11 at 07:56
  • no.. the question is different... I already made a walk.. – Alfred Apr 14 '11 at 11:27

3 Answers3

1

use the jQuery sound plugin.

Caspar Kleijne
  • 20,852
  • 11
  • 68
  • 100
  • Just in case someone actually believes this can't be done in plain javascript, here's the code in that plugin: `$("body").append('');` – Christian Apr 14 '11 at 07:39
0

You dont need jQuery..

<BGSOUND ID="SOUND_ID" LOOP=1 VOLUME="-200" SRC="mySound.mid">

document.all['SOUND_ID'].src='mySound.mid';

If you need a more fancy player you will need to embed on of those flash player and pass your mp3 file as source. Google it out, there are many.

Robin Maben
  • 20,994
  • 16
  • 62
  • 96
  • 2
    10 years ago it would have been a great tip :). AFAIK it is supported only in IE, but in IE8 they might have stopped supporting it. – kapa Apr 14 '11 at 07:33
  • I agree. But the jQuery sound plugin in Caspar's answer builds around pretty much the same thing. – Robin Maben Apr 14 '11 at 07:38
0

You can use HTML5's audio element.

HTML5 audio on Nettuts - there is a jQuery example

kapa
  • 75,446
  • 20
  • 155
  • 173