Linked Questions

Popular Questions

How to pass the JavaScript value into input field

Asked by At

I did the code for to move the range button the amount will increasing that value coming for span id also i did this through JavaScript but i try get that same value in inside the input field i can't understand what is the issues please help me to fix this issues.

var output = document.getElementById("demo");

document.getElementById("demo").value = output;

output.innerHTML = slider.value;

slider.oninput = function() {
    output3.innerHTML = this.value;
    output.innerHTML = this.value;

 output2.innerHTML = this.value;
}
<div class="col-md-12">
  <p>Loan Amount<span id="demo3"></span></p>
  <input type="range" min="5000" max="50000" value="1000" class="slider" id="myRange" step="1000">
</div>


<div class="col-md-12">
  <p>Loan Period</p>
  <input type="range" min="10" max="50" class="slider" id="myRange2" step="10" oninput="getInput(this.value)">
</div>


<div class="col-md-4">
  <img src="./assets/img/cal-01.png" style=" max-width: 48%; " />
  <p>Loan Amount:<br/><span id="demo"></span></p>
</div>

<div class="col-md-4">
  <img src="./assets/img/cal-02.png" style=" max-width: 37%; " />
  <p>Loan Period:<br/><span id="demo4"></span> Days</p>
</div>


<input type="text" class="form-control" id="demo" name="demo">

I want to pass the span ID value to Input field ID

Related Questions