Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
How do I add a mute/unmute button to this auto playing sound?

I am trying to add a mute button for this sound that plays in the background on my webpage. Can someone please help me try to do this? Here is my HTML code that plays the sound:

<audio id="sound" autoplay="autoplay" loop="loop">
    <source src="song.mp3" type="audio/mp3">
</audio>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You'll have to access your audio element and trigger the muted attribute.

Example on how to do that:

<!-- HTML -->
<button onclick="toggleMuted()">Mute|Unmute</button>
<audio id="sound" autoplay="autoplay" loop="loop">
    <source src="song.mp3" type="audio/mp3">
</audio>
// JS
function toggleMuted() {
  var sound = document.getElementById('sound');
  sound.muted = !sound.muted;
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!