Suggestion: support data-barcode on target object
See original GitHub issueI 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 string.search 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">
JS
$(document).ready(function () {
$('.barcode').each(function () {
var barcodeValue = "" + $( this ).data('barcode'),
barcodeType = "ean" + barcodeValue.length;
$( this ).JsBarcode(barcodeValue, {
format: barcodeType ,
height: 40,
displayValue:true,
fontSize:14,
textMargin: 2,
background: "transparent",
margin: 0
});
});
});
It would be great to add support for this data property by default.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did release v3.3.0 now. Closing the issue.
v3.3.0-beta.2 added the missing support of jQuery init (of more than 1 element).