Creating a List of barcodes
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
When I loop through the number of barcodes that I need to generate, I get that the barcode will print the number of those barcodes but the the text remains the same. I also need to change the text.
e.g.
for (var i = 0; i < copies; i++) {
let finalCode = "";
const codeNumeber = i + 1;
finalCode = code.concat(codeNumeber);
console.log(finalCode);
var line = document.createElement("img");
line.setAttribute("id", "barcode");
document.getElementById("barcodeClass").appendChild(line);
JsBarcode("#barcode", finalCode, {
fontOptions: "bold",
width: 1
});
}
will print

Contributor guide
Research direction
Start with the browser usage shown in the issue and inspect how JsBarcode handles repeated rendering into elements selected by an id. Reproduce the loop with distinct barcode values and verify that each generated barcode displays its own value rather than reusing the first element's text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100