Download
- Overview
- Documents
User Rating: 0.1/5 ( 1 votes)
Your Rating:
jQuery EAN13 is a lightweight (~3kb) jQuery plugin for in-place generation of EAN-13 barcodes.
Source: github.com
1. INCLUDE JS FILES
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="../dist/jquery-ean13.js"></script>
2. HTML
<canvas id="ean" width="400" height="200"></canvas>
3. JAVASCRIPT
$("#ean").EAN13("9002236311036");
4. OPTIONS
Without number
For only printing the barcode use the code below:
$("#ean").EAN13("9002236311036", {
number: false
});
Set the prefix option to false to not print the country prefix:
$("#ean").EAN13("9002236311036", {
prefix: false
});
Set the color option to a color to print the barcode with it.
$("#ean").EAN13("9002236311036", {
color: "#f00"
});
$("#ean").EAN13("9002236311036", {
color: "rgb(255,0,0)"
});
$("#ean").EAN13("9002236311036", {
color: "rgb(255,0,0,0.2)"
});
5. CALLBACKS
onValid
When the code is valid, the onValid callback gets executed.
$("#ean").EAN13("9002236311036", {
onValid: function(){
// do
}
});
When the code is invalid, the onInvalid callback gets executed.
$("#ean").EAN13("9002236311036", {
onInvalid: function(){
// do
}
});
When the barcode generation and draw process has succeeded onSuccess gets called.
$("#ean").EAN13("9002236311036", {
onSuccess: function(){
// do
}
});
When the plugin (canvas-element) is not supported by the browser or the code length is wrongonError gets called.
$("#ean").EAN13("9002236311036", {
onError: function(){
// do
}
});
JS Tutorial
