Created
April 5, 2018 07:34
-
-
Save ifirmawan/90fca7e77073e49f9558f3556b0ac8a4 to your computer and use it in GitHub Desktop.
Menyalakan bunyi notifikasi melalui jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<audio id="notif_audio"> | |
<source src="<?php echo base_url('sounds/notify.ogg');?>" type="audio/ogg"> | |
<source src="<?php echo base_url('sounds/notify.mp3');?>" type="audio/mpeg"> | |
<source src="<?php echo base_url('sounds/notify.wav');?>" type="audio/wav"> | |
</audio> | |
<button type="button" class="btn-play"> | |
Play ! | |
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$(document).on('click','.btn-play',function(){ | |
$('#notif_audio')[0].play(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment