JsBarcode
JsBarcode copied to clipboard
Creating a List of barcodes
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

What i did was line.setAttribute("id", "a"+i); and JsBarcode("#a"+i, .....) which worked !