jQuery: dealing with multiple keypress listeners?
<p>I have a page that needs to do two things at once:</p>

<ul>
<li>Listen all the time for input from a scanner (which presents as keyboard input), and notice when a string is entered in the right format.</li>
<li>Listen for a user focussing on a particular dropdown, and typing a set of initials - when a set of initials is entered that matches the <code>title</code> attribute of an item in the dropdown, focus on that dropdown.</li>
</ul>

<p>I can do either of these things separately, but not together. Code:</p>

<pre><code>// Listen for input when userlist is in focus. 
$("#userlist").keypress(function (e) {
    initials += String.fromCharCode(e.which).toUpperCase();
    $(this).find("option").filter(function () {
        return $(this).attr("title").toUpperCase().indexOf(initials) === 0;
    }).first().attr("selected", true);      
    // uses timer to check for time between keypresses
    return false;
});
// Listen for scanner input all the time. 
var input = '',
    r1 = /^~{1}$/,
    r2 = /^~{1}\d+$/,
    r3 = /^~{1}\d+\.$/,
    r4 = /^~{1}\d+\.\d+$/,
    r5 = /^~{1}\d+\.\d+~{1}$/;
$(window).keypress(function(e) {
    // when input matches final regex, do something  
}    
</code></pre>

<p>If I have both, then while the user is focussed on the dropdown, the page does not 'hear' the input from the scanner.</p>

<p>How can I combine the two together to make sure the page reacts to scanner input, even while the user is focussed on the dropdown?</p>
