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

326
Views
How am i supposed to pass the value of a slider to a javascript function?

So i'm trying to pass a value of a slider onto a javascript function, to set the volume of an audio. I'm very new to javascript so i'm not quite sure what i'm doing but Chrome complains about Uncaught TypeError: Cannot read property 'value' of null.

HTML5 code

<div class="mt-2">Volume</div>
        <div class="slidecontainer">
         <input type="range" min="1" max="100" value="50" class="slider" id="musicVolume">
         <output id="musicVolume"> </output>

Javascript code

// Create audio object
var themeAudio = new Audio()
volumeSlider = parseInt(document.getElementById("musicVolume").value );  
themeAudio.volume = volumeSlider
themeAudio.loop = true

(The javascript code is under it's own file, background.js while the HTML code is under popup.html)

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

0

You can put <script /> in the bottom on your <body> or add attribute deffer for script

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!