Jquery Plugin
Barcode
Generate BarCode Using Javascript Library - JsBarcode
Today I am going to share awesome javascript plugin to create barcode. Using this library you can easily generate various types of barcodes. Barcode generation library works in both the browser and on Node.js.
- 4.5/5.0
- Last updated 09 September, 2022
- By Admin
JsBarcode is a barcode generator written in JavaScript. It supports multiple barcode formats and works in browsers and with Node.js. It has no dependencies when it is used for the web but works with jQuery if you are into that.
Libraries
First load the minified all barcode library from CDN
Or you can load the separate barcode format files if you don’t want to add all barcode format.
HTML
Create an canvas (or image) element where barcode will display.
JS
Now call the barcode function with text which barcode need to generate. there are tow method one directory call the function and pass the parameter and second one by using jquery method.
JsBarcode("#barcode", "Hi!"); // or with jQuery $("#barcode").JsBarcode("Hi!");
You can pass more options to customize barcode.
JsBarcode("#barcode", "1234", { format: "pharmacode", lineColor: "#0aa", width:4, height:40, displayValue: false });
Or define the value and options in the HTML element: