A Pen by Kris Scorup on CodePen.
Created
January 11, 2022 02:40
-
-
Save abdo-host/7a411c22f286420e8bb2621934564a81 to your computer and use it in GitHub Desktop.
jquery-scanner-detection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p id="pTest"></p> | |
<input id="iTest"></input> | |
<div id="some-test-element">Click me</div> | |
<div class="search"> | |
<input id="foo" type="text" value="y u no work" autofocus/> | |
</div> | |
<div id="focus-here">this spot</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).scannerDetection({ | |
timeBeforeScanTest: 200, // wait for the next character for upto 200ms | |
avgTimeByChar: 100, // it's not a barcode if a character takes longer than 100ms | |
onComplete: function(barcode, qty){ | |
$('#pTest').text(barcode); | |
alert(barcode); | |
} // main callback function | |
}); | |
$('#some-test-element').click(function() { | |
$('div#focus-here').focus(); | |
}) | |
//$('.search').find('input#foo').focus(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> | |
<script src="https://rawgit.com/kabachello/jQuery-Scanner-Detection/master/jquery.scannerdetection.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment