Barcode scanner for html5 and jquery application
Asked Answered
B

4

12

I am using Jquery and html for a project. It is a static web application. I need a jquery that reads barcode scanner's barcode from products. The barcode need to be scanned without displaying the code in any of the textbox in the screen. Someone please gibe me some ideas or provide me the link for plugins (if any) to overcome this. Thanks in advance.

Brescia answered 1/4, 2014 at 5:53 Comment(2)
Do you physically scan it or do you want to scan soft copy of bar code? Are you using Barcode readerDinky
I have a barcode scanner which I used to scan the productsBrescia
D
19

Try this code. I assum that you know about the Jquery. Run this code and type anything from the keyboard while focusing the web page and hit enter key. If this works barcode reader do the same. Configure your barcode reader to pass enter key at the end of code reading. Jquery library

<script type='text/javascript' src='http://code.jquery.com/jquery-1.6.4.js'></script>

Jquery

$(document).ready(function() 
{
    var barcode="";
    $(document).keydown(function(e) 
    {
        var code = (e.keyCode ? e.keyCode : e.which);
        if(code==13)// Enter key hit
        {
            alert(barcode);
        }
        else if(code==9)// Tab key hit
        {
            alert(barcode);
        }
        else
        {
            barcode=barcode+String.fromCharCode(code);
        }
    });
});
Dinky answered 1/4, 2014 at 6:48 Comment(5)
If you need to capture Tab key change code==13 to code==9Dinky
I have faced an issue with this code. When I am scanning the special characters the ASCII character are varied based on the browser.Brescia
Which type of Special characters?Dinky
Please visit this page. I think this will help you. bennadel.com/blog/…Dinky
Please ignor my https://mcmap.net/q/925460/-barcode-scanner-for-html5-and-jquery-application answer. Do not down vate me for that answer. I have corrected it hereDinky
S
0

May be you can try this https://code.google.com/p/jquery-barcodelistener/ .

It catches the barcode scanner's output and gives to you as a parameter

Staysail answered 1/4, 2014 at 6:42 Comment(1)
I would like to get a document preferably code snippet alsoBrescia
F
0

I found this quite old but pretty good post which was working fine with my hardware.

I have implemented it into a jquery plugin: jquery-code-scanner, you can try it here to see if it works with your code reader.

$ bower install jquery-code-scanner
<script src="js/jquery.min.js"></script>
<script src="js/jquery-code-scanner.js"></script>
<!-- ... -->
<input type="text" id="code-scan">
$('#code-scan').codeScanner();

Don't hesitate to create issues or PRs on the project.

Fitton answered 11/5, 2016 at 15:15 Comment(2)
can i use this in angular 8?Aw
don't work if we have two input textsBracteate
W
0

look at Barcode scanner.its using vue js libaray for scanning barcode

Witenagemot answered 23/8 at 7:56 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Vigilance

© 2022 - 2024 — McMap. All rights reserved.