Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

96
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda