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

240
Views
how would I make a volume slider in html?

I'm currently trying to make a volume slider for my site, due to the fact i know very, very limited js - i cant figure out how.

code below

      var audio = new Audio("audio.mp3");
      audio.volume = 1;
      audio.loop = true;
      document.onclick = function() {
        audio.play();
      }

i tried using ids, classes and more still didn't work for me

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Something fairly simple could work for you. You could create a range input into your html file and then use that specific range to create a volume slider

Volume slider in html:

<input type="range" id="volume-slider">

You could then use that slider in js and convert its value to change your volume like so:

let volume = document.getElementById('volume-slider');
volume.addEventListener("change", function(e) {
    audio.volume = e.currentTarget.value / 100;
})

Source from a similar answer: Js Audio Volume Slider

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!