Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!