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

250
Vistas
How to delete line and update totals in Javascript

Here is what I'm trying to do.

I'm trying to delete a line item and update the order with the current code:

The HTML code:

<div class="invoice-billing">
    <div class="invoice-billing-item"><input type="text" class="form-control" id="sku-%ID%" name="sku-%ID%" /></div>
    <div class="invoice-billing-item"><input type="text" class="form-control" id="description-%ID%" name="description-%ID%" /></div>
    <div class="invoice-billing-item">
        <label class="switch" for="taxable-%ID%" style="margin-left: 4px; top: 4px;">
            <input type="checkbox" class="taxable-%ID%" name="taxable-%ID%" id="taxable-%ID%" />
            <div class="slider round gray"></div>
        </label>
    </div>
    <div class="invoice-billing-item"><input type="text" onchange="updateInvoiceValue()" class="form-control invoice-billing-qty" id="qty-%ID%" name="qty-%ID%" /></div>
    <div class="invoice-billing-item"><input type="text" onchange="updateInvoiceValue()" class="form-control invoice-billing-unit-price" id="unit-price-%ID%" name="unit-price-%ID%" /></div>
    <div class="invoice-billing-item invoice-billing-item-ext-price">
        <div id="ext-%ID%"></div>
    </div>
    <a class="invoice-billing-item-trash" id="del-%ID%" name="del-%ID%" onchange="updateInvoiceValue()"><i class="fas fa-trash-alt"></i></a>
</div>

Here is the JavaScript code:

function updateInvoiceValue() {
    for (var i = 1; i < newInvoiceIndex; ++i) {
        $("#del-" + i).on("click", function () {
            var quantity = parseInt($("#qty-" + i).val());
            var unitPrice = Number($("#unit-price-" + i).val());
        });
    }
}

The problem is that I'm getting a NaN on the numeric fields even though there is a value on the field. How can I get the values of the numeric fields and remove an line item? I pretty much know how to update the totals

Thank you...

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