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

147
Views
I want to reset my table that shows value whenever I click input box using jquery

Here is my code in document.ready

$('#num-input').on('click', (e) => {
        e.preventDefault();
        $('#div-error').hide()
        let id = $(this).attr("id"); /** order id */

        let inputVal = $(`#unit-${id}`)
        inputVal.val('')

Here is the code in splittingNumber function.

let arr = []
        let i = 1
        while (num > i / 10)
        {
            arr.unshift(num % i - num % (i / 10));
            i *= 10;
        }
        // console.log(arr.slice(0, -1))
        result = arr.slice(0, -1)
        result.forEach((el, i) => {
            // $('#unit').val(el)
             $("#unit").append(`
                <tr>
                    <th scope="row" class="table-bordered" id="unit-${i}">${el}</th>
                </tr>
            `)
            console.log(el, i);
        });
        console.log(result)

I want to reset the value table when I click the input box so it wont be like this anymore: picture

about 4 years ago · Juan Pablo Isaza
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!