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

151
Views
how to get slider value into multiple form input field instantly on each change?

In a form we have three input fields with the same value and these fields are displaying when we choose value from dropdown for example if I choose value "2" from dropdown the we will get two rows with six input field means three in first row and another three in second row and we have a range slider . When slider goes up then input field value should be increase by 0.5 and default value of input is 5. Problem is I can't able to display the value in input field when I am increasing the range of a slider.

function changeslider(val) {
  console.log(val)
  document.getElementById('slide1').value = val;
  document.getElementById('slide2').value = val;
  document.getElementById('slide3').value = val;
}
<div class="form-group">
     <label>No. of Rounds</label>
     <select class="form-control select2 select2-init" id="state_0" 
     name="Address">
     <option value="Select number rows">Select number rows</option>
         <option>1</option>
         <option>2</option>
         <option>3</option>
         <option>4</option>
     </select>
  </div>
    <input class="range" type="range" min="0" value="5" step="0.5" 
     id="myrange" onchange="changeslider(this.value);">

    <tbody id="tbody">
      <tr id="table_tr">
        <td><input type="text" class="form-control" id="slide1" name="round1[]" value="0" required></td>
        <td><input type="text" class="form-control" id="slide2" name="round2[]" value="0" required/></td>
        <td><input type="text" class="form-control" id="slide3" name="round3[]" value="0" required/></td>

      </tr>
    </tbody>

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

0

Change event from onchange to oninput

onchange : Works when you changed the value from the input and focus(removed by mouse clicked outside input or when mouse out) is removed from slider

oninput : Works on each value entered whether there is change in focus of input(here slider) or not

function changeslider(val) {
  console.log(val)
  document.getElementById('slide1').value = val;
  document.getElementById('slide2').value = val;
  document.getElementById('slide3').value = val;
}
<input class="range" type="range" min="0" value="5" step="0.5" id="myrange" oninput="changeslider(this.value);">

<tbody id="tbody">
  <tr id="table_tr">
    <td><input type="text" class="form-control" id="slide1" name="round1[]" value="0" required></td>
    <td><input type="text" class="form-control" id="slide2" name="round2[]" value="0" required/></td>
    <td><input type="text" class="form-control" id="slide3" name="round3[]" value="0" required/></td>

  </tr>

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!