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

103
Views
Tell me how to display a variable not in span, but in input with this code

Tell me how to display a variable not in span, but in input with this code.

$(function(){
    $('#main input:radio').on("change", function(){
         var summ = 18900;
        $('#main input:radio:checked').each(function(index, element){
            var add = parseInt($(element).val(), 10); 
            if(!isNaN(add))
                summ += add;
        });
        $("#result span").text(summ);   
    })   
})  

<div class="result d-flex justify-content-center  md-auto" id="result">
<span>18900</span> руб.
<input type="text" id="result" value="18900">
</div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your input should be the only element with the 'result' value in it's id property.
If you will do so, you will be able to use js document.getElementById('result') to get the input element, and then set it's 'value' property
(e.g. document.getElementById('result').value = sum;)

You can also use jQuery format
(e.g. $('#result').val(sum);)

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!