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

90
Views
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 answers
Answer question

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 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!