JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

Uncaught "undefined" is not a valid input for e in line JsBarcode.ean-upc.min.js:2:34333

Open OliverCG opened this issue 5 months ago • 0 comments

Hi,

I'm using the JsBarcode library to show a barcode image and despite the fact that it's working fine, I'm getting an error in the console quite strange that I can not find out what's happening.

First of all, I'm loading the library from the cdn:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/barcodes/JsBarcode.ean-upc.min.js"></script>

Then, I'm generating the barcode as follows:

TPL/HTML file:

<svg class="barcode"
  jsbarcode-format="{$key}"
  jsbarcode-value="{$reference|@trim|intval}"
  jsbarcode-textmargin="0"
  jsbarcode-fontoptions="bold"
  jsbarcode-width="2"
  jsbarcode-height="40">
</svg>

Where key is being replaced by "ean13" and the reference is being replaced by the ean13 number in integer format.

JS CODE:

$(document).ready(function(){
  setTimeout( function() 
  {
    JsBarcode(".barcode").init();
  }, 500);
});

The svg is loading well, but I'm getting the following error in the console:

Uncaught "undefined" is not a valid input for e [JsBarcode.ean-upc.min.js:2:34333](https://cdn.jsdelivr.net/npm/[email protected]/dist/barcodes/JsBarcode.ean-upc.min.js)
    value https://cdn.jsdelivr.net/npm/[email protected]/dist/barcodes/JsBarcode.ean-upc.min.js:2
    value https://cdn.jsdelivr.net/npm/[email protected]/dist/barcodes/JsBarcode.ean-upc.min.js:2
    init https://cdn.jsdelivr.net/npm/[email protected]/dist/barcodes/JsBarcode.ean-upc.min.js:2

I have read the documentation several times and everything seems to be okay. Can you help me?

Thank you in advance.

OliverCG avatar Feb 01 '24 11:02 OliverCG