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

155
Views
How to change the text next to a slider form using JavaScript

I have the following code in html and js

function slide(){
    let v= document.getElementById("slide_inner");
    document.getElementById("slider").textContent=v.value;
}
<form id="slider">
            <label for="slide_inner">0</label><input id="slide_inner" onchange="slide()" type="range" min="0" max="26" value="0" class="slider">
        </form>
        

However, when I try and move the slider, the slider also disappears and the only the value remains. I only want the 0 to be updated to the new slider value. Is there a way I can avoid this?

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

0

You can use querySelectorAll to set the text:

function slide() {
  let v = document.getElementById("slide_inner");
  document.getElementById("slider").querySelectorAll("label")[0].innerHTML = v.value;
}
<form id="slider">
  <label for="slide_inner">0</label><input id="slide_inner" onchange="slide()" type="range" min="0" max="26" value="0" class="slider">
</form>

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!