title: <span id="sample">0</span> to new input box
body: <p>I recently have a result in a modal from <code>calculatesum</code> JavaScript displayed as <code>&lt;span id="sample"&gt;0&lt;/span&gt;</code> (the value will increase based on the number key in by users)</p>
  
  <p>How do I display this final sample value in another input box outside of the modal? Help?</p>
  
  <p>JavaScript as below:</p>
  
  <pre><code>$(document).ready(function(){
  
      //iterate through each textboxes and add keyup
      //handler to trigger sum event
      $(".txt").each(function() {
  
          $(this).keyup(function(){
              calculateSum();
          });
      });
  
  });
  
  function calculateSum() {
  
      var sum = 0;
      //iterate through each textboxes and add the values
      $(".txt").each(function() {
  
          //add only if the value is number
          if(!isNaN(this.value) &amp;&amp; this.value.length!=0) {
              sum += parseFloat(this.value);
          }
  
      });
      //.toFixed() method will roundoff the final sum to 2 decimal places
      $("#sum").html(sum.toFixed(0));
  }
  </code></pre>
  
  <p>HTML or <code>rangeslide</code> code as below:</p>
  
  <pre><code>&lt;input type="text" class="form-control slider-text-field" id="homeContentInput" placeholder="250,000"&gt;
                  &lt;/td&gt;&lt;td&gt;&amp;nbsp;&amp;nbsp;(RM)&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
                  &lt;br/&gt;
                  &lt;input type="range" value="250000" min="15000" max="500000" step="10000" id="homeContentRange"&gt;
                  &lt;span class="slider-label-min"&gt;RM 15,000&lt;/span&gt; &lt;span class="slider-label-max"&gt;RM 500,000&lt;/span&gt;
  </code></pre>
  
  <p>Basically, I need to replace <code>placeholder="250,000"</code> for the first input box and <code>value="250000"</code> with the final value from <code>&lt;span id="sample"&gt;0&lt;/span&gt;</code>.</p>