0

How to Play Notification Sound using JQuery

Spread the love

last days when i was working on a chat app my client said to me to play a notification sound whenever a user receive new message from another user.I implemented this in a simple chat box application using Jquery and HTML5 audio tag, it is just five lines of code.check below :

play notification sound jquery ,play notification sound using jquery ,play notification sound using jquery ajax ,play notification sound using jquery android ,play notification sound using jquery datatable ,play notification sound using jquery event ,play notification sound using jquery example ,play notification sound using jquery function ,play notification sound using jquery grid ,play notification sound using jquery html ,play notification sound using jquery java ,play notification sound using jquery javascript ,play notification sound using jquery join ,play notification sound using jquery json ,play notification sound using jquery key ,play notification sound using jquery keyboard ,play notification sound using jquery knob ,play notification sound using jquery mobile ,play notification sound using jquery name ,play notification sound using jquery php ,play notification sound using jquery plugin ,play notification sound using jquery post ,play notification sound using jquery query ,play notification sound using jquery queue ,play notification sound using jquery quickly ,play notification sound using jquery router ,play notification sound using jquery select ,play notification sound using jquery ubuntu ,play notification sound using jquery ui ,play notification sound using jquery update ,play notification sound using jquery validate ,play notification sound using jquery validation ,play notification sound using jquery validator ,play notification sound using jquery version ,play notification sound using jquery windows 10 ,play notification sound using jquery wordpress ,play notification sound using jquery xml ,play notification sound using jquery youtube ,play notification sound using jquery z3 ,play notification sound using jquery zoom

HTML :

Here i created a UL tag to append all my messages in it.Then used an input with onkeydownevent so user can type a message and fire it with ENTER key.And the inportant audio tag with my audio sound so i can play it.

JavaScript :

In javascript i made the function process_chat().In this function i just checked if user pressed the ENTER key (with keycode event) then we will process for next work.Later in this script i got the value of input and appended that in our UL tag.After doning this i just used jquery’s play() function to play my audio file.

Hope it will Help You and please subscribe me and like my facebook page :

and make me proud.By the way if you face any problem then let me know in comment section below

Leave a Reply

Your email address will not be published. Required fields are marked *