Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda