{"action":"created","issue":{"url":"https://api.github.com/repos/lindell/JsBarcode/issues/70","repository_url":"https://api.github.com/repos/lindell/JsBarcode","labels_url":"https://api.github.com/repos/lindell/JsBarcode/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/lindell/JsBarcode/issues/70/comments","events_url":"https://api.github.com/repos/lindell/JsBarcode/issues/70/events","html_url":"https://github.com/lindell/JsBarcode/issues/70","id":153976177,"number":70,"title":"Suggestion: support data-barcode on target object","user":{"login":"fschaeffer","id":1931017,"avatar_url":"https://avatars.githubusercontent.com/u/1931017?v=3","gravatar_id":"","url":"https://api.github.com/users/fschaeffer","html_url":"https://github.com/fschaeffer","followers_url":"https://api.github.com/users/fschaeffer/followers","following_url":"https://api.github.com/users/fschaeffer/following{/other_user}","gists_url":"https://api.github.com/users/fschaeffer/gists{/gist_id}","starred_url":"https://api.github.com/users/fschaeffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fschaeffer/subscriptions","organizations_url":"https://api.github.com/users/fschaeffer/orgs","repos_url":"https://api.github.com/users/fschaeffer/repos","events_url":"https://api.github.com/users/fschaeffer/events{/privacy}","received_events_url":"https://api.github.com/users/fschaeffer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-10T10:43:13Z","updated_at":"2016-05-10T11:20:07Z","closed_at":null,"body":"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.\r\n\r\nFor the time being I use a jQuery snippet which reads the barcode information from the data property.\r\n\r\nAs your script uses string.search it is necessary to first cast the result of the data-call value to string to avoid an exception.\r\n\r\nHTML\r\n`<img class=\"barcode\" data-barcode=\"4012700014825\">`\r\n\r\nJS\r\n```javascript\r\n$(document).ready(function () {\r\n    $('.barcode').each(function () {\r\n        var barcodeValue = \"\" + $( this ).data('barcode'),\r\n            barcodeType = \"ean\" + barcodeValue.length;\r\n\r\n        $( this ).JsBarcode(barcodeValue, {\r\n            format: barcodeType , \r\n            height: 40, \r\n            displayValue:true, \r\n            fontSize:14, \r\n            textMargin: 2, \r\n            background: \"transparent\", \r\n            margin: 0\r\n        });\r\n    });            \r\n});\r\n```\r\n\r\nIt would be great to add support for this data property by default."},"comment":{"url":"https://api.github.com/repos/lindell/JsBarcode/issues/comments/218129299","html_url":"https://github.com/lindell/JsBarcode/issues/70#issuecomment-218129299","issue_url":"https://api.github.com/repos/lindell/JsBarcode/issues/70","id":218129299,"user":{"login":"lindell","id":284868,"avatar_url":"https://avatars.githubusercontent.com/u/284868?v=3","gravatar_id":"","url":"https://api.github.com/users/lindell","html_url":"https://github.com/lindell","followers_url":"https://api.github.com/users/lindell/followers","following_url":"https://api.github.com/users/lindell/following{/other_user}","gists_url":"https://api.github.com/users/lindell/gists{/gist_id}","starred_url":"https://api.github.com/users/lindell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lindell/subscriptions","organizations_url":"https://api.github.com/users/lindell/orgs","repos_url":"https://api.github.com/users/lindell/repos","events_url":"https://api.github.com/users/lindell/events{/privacy}","received_events_url":"https://api.github.com/users/lindell/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T11:20:07Z","updated_at":"2016-05-10T11:20:07Z","body":"> 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.\r\n\r\nThis is a bug and should be fixed."}}