How to use barcode Scanner in web Application

后端 未结 2 831
暖寄归人
暖寄归人 2021-02-06 07:42

I would like to use barcode scanner in my Laravel application. This is an online Point of Sale Application. I know that barcode scanner returns just a string and press Enter But

2条回答
  •  时光说笑
    2021-02-06 08:44

    Yes, there are two ways:

    The autofocus attribute

    
    

    You can use the autofocus attribute, but this may not be supported by any browser.

    Use Javascript

    This is a fallback for the autofocus attribute.

    window.onload = function() {
        var input = document.getElementById("barcodeInput").focus();
    }
    

    This will set the focus as soon as the page is loaded inside the input with the id barcodeInput.

    If you are using JQuery you can do it this way:

    $(document).ready(function() {
        $('#barcodeInput').focus();
    });
    

提交回复
热议问题