Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda