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

97
Visualizações
How to display results in input field from td tag

my title may be hard to understand but i didnt know how to ask this question so let me explain. Here is my script

$(this).parent("td").siblings("td:last").text(intTotal);

This script display results inside td tag <td></td>.. How do i make the intTotal to display inside input field <input id="total"> please note i have many rows and i tried using $("#total").val(intTotal) but this can only work if i had 1 row.

Here is the rest of the script

    var strClass = $(this).prop("class");
    var intTotal = 1;
    $.each($("input:text." + strClass), function () {
        var intInputValue = parseInt($(this).val());
        if (!isNaN(intInputValue))
        {
            intTotal = intTotal * intInputValue;
        }
    });
    $(this).parent("td").siblings("td:last").text(intTotal);
});

Thank You

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Your code below sends the results to the last element of the td.

$(this).parent("td").siblings("td:last").text(intTotal);

To assign a value inside an element using jQuery, you must first select it and then edit its content using the html(), text(), val()... functions.

In your case, the code below will update the value of the input with the #total id.

$("#total").val(intTotal);
about 4 years ago · Santiago Gelvez 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