Thanks Girish. I'll look into the plugin you linked to.

Btw, the reason I'm using single keys is to keep from conflicting with
any OS or Browser hotkeys. I've also grown to prefer them because of
Gmail and Google Reader.

Ryan

On Nov 1, 7:20 pm, Girish Venkatachalam
<[EMAIL PROTECTED]> wrote:
> On 14:53:28 Nov 01, ryanfitzer wrote:
>
>
>
> > I'm building in a few keypress events into a site and I'm having
> > trouble keeping them from triggering when a text field has focus. For
> > some reason this only happens on the second if statement. The first
> > one does fine. What am I missing?
>
> I am not sufficiently conversant on DOM events or javascript to answer
> this. I am sure you are missing something though. ;)
>
> If you use this plugin [1] you can specify an option 'disableinInput: true'
> for getting what you want.
>
> I for some reason do not like single keypresses for my hotkeys. I ended
> up using a combination of 'Shift with an alphabet/number' and 'Crtl with
> an alphabet/number.'
>
> That way you don't have to deal with disabling and re enabling them in
> input fields.
>
> Moreover you also have to be careful that you do not tread on the very
> many keyboard shortcuts provided by Opera and FF.
>
> > The code:
>
> > $('*:not(:input)').keypress(function(e){
>
> >     if(e.keyCode == some number) {
> >          //some function
> >     } else if (e.keyCode == some number) {
> >         //another function
> >     }
>
> > });
>
> > The functions are for things unrelated to input. I'm using them for
> > image navigation, bring up modal windows, etc...
>
> I think you really should be using the awesome(people seem to like this
> word a lot ;) plugin for this. [1]
>
> If not for anything else then at least for cross browser uniformity you
> might want this plugin.
>
> I got it working after fighting with it for a while and I could send my
> code to the list should anyone have the need for the same.
>
> Keyboard shortcuts are an amazing way to use a web interface. It is a
> pity most people do not realize this fact.
>
> -Girish
>
> 1.http://code.google.com/p/js-hotkeys/

Reply via email to