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:
