<input type="text" class="barcode">
<script>var barcode= document.getElementsByClassName('barcode')[0],
barcodeTimeoutId;
barcode.addEventListener('keyup', function () {
clearTimeout(barcodeTimeoutId);
barcodeTimeoutId = setTimeout(function () {
alert('Прошло 2 сек. после ввода');
}, 2000);
}, true);</script>