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

145
Vistas
jquery coupon field not working after changing the addition code

Hi guys im new to coding and im trying to add a coupon code field to my form in contact form 7 in wordpress, the problem I had is that i assigned a value for adult and kid, and depending on the amount of each it would return the total value, but it was returning the value of both adult and kid even if there was only 1 adult and 0 kid, so i found a fix by using this code subtotal = $("#subtotal").val(Number($("#adult").val()*35) + Number($("#kid").val()*18.40)); ,but know the couponcode field does not work, I would really appreciate your help, thanks. This is the link to the form im working on.

The code im using.

jQuery(document).ready(function () {
  //alert("Welcome");
  var adult;
  var kid;
  var subtotal;
  var total;
  var couponcode;

  jQuery("#adult, #kid").on("change", function () {
    adult = this.value;
    kid = this.value;

    subtotal = $("#subtotal").val(
      Number($("#adult").val() * 35) + Number($("#kid").val() * 18.4)
    );
    jQuery("#subtotal").val(subtotal.toFixed(2));
  });

  jQuery('input[name="couponcode"]').on("input keydown keyup", function (e) {
    let couponcode = jQuery('input[name="couponcode"]').val().trim();

    if (couponcode == "CCPPF") {
      total = subtotal * 0.1;
      jQuery("#total").val(total.toFixed(2));
    }
  });
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looking at your site reference, which has changed since my previous comment:

enter image description here

The reference to: jQuery("#total"), should be: jQuery("#totcalc")

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