# 자바스크립트로 바코드스캐너 연결하기

- 주소: https://duotone.co.kr/entry/%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EB%A1%9C-%EB%B0%94%EC%BD%94%EB%93%9C%EC%8A%A4%EC%BA%90%EB%84%88-%EC%97%B0%EA%B2%B0%ED%95%98%EA%B8%B0
- 글쓴이: 서기㏇
- 카테고리: 개발·프로그래밍
- 작성일: 2019-05-15
- 태그: Barcode, JavaScript, jQuery, 바코드스캐너, 자바스크립트

[scan.js 0.01MB](https://duotone.co.kr/media/e6f8575d7e7fbe6d.js)

jquery를 사용시 아래와 같이 하면 바코드 스캐너로 입력하는 값을 처리할 수 있습니다. 

 

 

```
   $(document).scannerDetection({
        timeBeforeScanTest: 200, // wait for the next character for upto 200ms
        startChar: [120], // Prefix character for the cabled scanner (OPL6845R)
        endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
        avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
        onComplete: function(barcode, qty){

            alert(barcode); // 바코드 출력

        }
  });
```
