javascript - Word counter function not working with barcode scanner -



javascript - Word counter function not working with barcode scanner -

$("#itemids").keypress(function(){ var value = $(this).val().replace(" ", ""); var words = value.split(","); $("#counter").html(words.length); });

this function works keyboard. when utilize barcode scanner, (i'm focusing cursor on textarea , starts scan barcode textarea delimiters comma.) doesn't work @ all.

i think must other keypress(function() . because bc scanner enters words programmatically. how work both situations: keyboard , bc scanner?

it looks solution use polling, not events.

function update(){ var value = $("#itemids").val().replace(" ", ""); var words = value.split(","); $("#counter").html(words.length); } setinterval(update, 10); // poll every 10ms

javascript jquery function counter

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -