How to get a Javascript routine to NOT act if it's in a text box?
        Posted  
        
            by talkingnews
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by talkingnews
        
        
        
        Published on 2010-05-09T17:12:25Z
        Indexed on 
            2010/05/09
            17:18 UTC
        
        
        Read the original article
        Hit count: 303
        
I've got a simple page, and in that page runs a simple jquery keypress routine to catch clicks of the numbers 1 to 9 (has to be that to pass RNIB accessibility test).
And in that page is a form, which can have numbers entered as part of a postcode.
http://find.talking-newspapers.co.uk/result.php?addressInput=kingston
Scroll to the bottom, try typing 8 or 9 for example. The text is entered, but it also acts on the keypress. Expected, but not good.
I'm aware of various things like document.getElementById, but I can't figure out how to put these together to ensure that while the cursor is in the text input box, it doesn't act out the keypress catcher.
© Stack Overflow or respective owner