Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: support data-barcode on target object

See original GitHub issue

I am using your great library in an web application where the barcode value(s) are being output from a db. As the values for that barcode are dynamic and there will be more than one barcode I can’t construct the values in JS by using an ID.

For the time being I use a jQuery snippet which reads the barcode information from the data property.

As your script uses it is necessary to first cast the result of the data-call value to string to avoid an exception.

HTML <img class="barcode" data-barcode="4012700014825">


$(document).ready(function () {
    $('.barcode').each(function () {
        var barcodeValue = "" + $( this ).data('barcode'),
            barcodeType = "ean" + barcodeValue.length;

        $( this ).JsBarcode(barcodeValue, {
            format: barcodeType , 
            height: 40, 
            textMargin: 2, 
            background: "transparent", 
            margin: 0

It would be great to add support for this data property by default.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

lindellcommented, May 12, 2016

Did release v3.3.0 now. Closing the issue.

lindellcommented, May 12, 2016

v3.3.0-beta.2 added the missing support of jQuery init (of more than 1 element).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify Barcode Formats and Count - Dynamsoft
This page describes how to set barcode formats and count in Dynamsoft Barcode ... Be sure to confirm that the target barcode formats...
Read more >
QR code, BarCode as representation inside a table
Hello all, As the title suggests, I would like to represent somes values as barcode or as QRCode. This allows a quick reading...
Read more >
Recommendations for Using Barcode in Hospital Process - PMC
The present research aimed to investigate the requirements and barrier for using barcode technology and presenting suggestions to use it.
Read more >
HDF5 Feature-Barcode Matrix Format -Software - Support
H5 is a binary format that can compress and access data much more efficiently than text formats such as MEX, which is especially...
Read more >
Javascript: How to read a hand held barcode scanner best?
Look at the event object to determine the "key" that was pressed. To determine when the entire code has been scanned, you might...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found