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

133
Vistas
Javascript to add additional inputs on webform works until I upload it onto BigCommerce Website

I have a webform which I am trying to allow the end user to be able to press an "ADD" button to increase the amount of "Serial Number" fields on a Warranty Registration Form submission page. It works flawlessly minus some missing CSS when testing the webform out using a website like https://jsfiddle.net however when I pack my theme together and upload it to my BigCommerce website, the ADD button does nothing and there are no errors in the console.

Here is the Javascript for the form to duplicate the field:

$('.add').on('click', add);
$('.remove').on('click', remove);

function add() {
    var new_chq_no = parseInt($('#total_chq').val()) + 1;
    var new_input = "<input type='text' id='new_" + new_chq_no + "'>";

    $('#new_chq').append(new_input);

    $('#total_chq').val(new_chq_no);
}

function remove() {
    var last_chq_no = $('#total_chq').val();

    if (last_chq_no > 1) {
        $('#new_' + last_chq_no).remove();
        $('#total_chq').val(last_chq_no - 1);
    }
}

And here's a pastebin of the html for the form https://pastebin.com/4WqjHccE

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Figured it out, The Javascript was being loaded before the html or something along those lines, so I just instead of loading the Javascript as a separate file, I injected it in using tags after where I needed it and it works like I need it to.

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