.init() - lindell/JsBarcode GitHub Wiki
The .init()
function provides a way to specify the options of the rendering in HTML instead of the parameters.
Just set HTML attributes as jsbarcode-*
or data-*
where *
is any of the JsBarcode options.
<svg class="barcode"
jsbarcode-format="upc"
jsbarcode-value="123456789012"
jsbarcode-textmargin="0"
jsbarcode-fontoptions="bold">
</svg>
JsBarcode(".barcode").init();
If you want to generalize some options to all of the initialized barcodes you can do that by first calling the options function.
JsBarcode(".barcode").options({
width: 1,
height: 25,
margin: 0
}).init();