Detect when input box filled by keyboard and when by barcode scanner.

前端 未结 11 2069
星月不相逢
星月不相逢 2020-12-01 00:44

How I can programmatically detect when text input filled by typing on keyboard and when it filled automatically by bar-code scanner?

11条回答
  •  一整个雨季
    2020-12-01 01:37

    $(window).ready(function(){
    
    	//$("#bCode").scannerDetection();
    
    	console.log('all is well');
    	
    	$(window).scannerDetection();
    	$(window).bind('scannerDetectionComplete',function(e,data){
                console.log('complete '+data.string);
                $("#bCode").val(data.string);
            })
            .bind('scannerDetectionError',function(e,data){
                console.log('detection error '+data.string);
            })
            .bind('scannerDetectionReceive',function(e,data){
                console.log('Recieve');
                console.log(data.evt.which);
            })
    
            //$(window).scannerDetection('success');

提交回复
热议问题