Learn to Code via Tutorials on Repl.it!

← Back to all posts
Add sound to a button in Html and JavaScript!
[deleted]

Learn how to Add sound when we click a button on a website!

Let's get started!

Add a button in HTML!

JavaScript!

In the above code, we just linked an external JS file

As we've coded above, when we click on the button, a function gets executed, so let's create the function named sound!

Note: Upload the sound you want to play in the repl

Upvote if you find it helpful :)

Voters
skenne28
XEROxMEXICANO
CATSAG7PRO
Comments
hotnewtop
ItamarCohen28

BRUHHHHHHHHHHHHHHHHHHHHHHH

YOU SCARED THE # HELL OUTTA ME!

[deleted]

coooooooooooooooooooollll!!!!!!!

ch1ck3n

@Hacky Forgot to switch accounts?

GlitchWarrior

@ch1ck3n HAHAHAHHA