On Dec 24, 2007 6:49 PM, Michael Geary <[EMAIL PROTECTED]> wrote: > > How does "the user is filling in a form" equate to "the mouse is over an > input element"? Those seem like two quite different and unrelated things. > > I've watched a lot of people fill in forms, and quite often they will click > in an input element and then move the mouse out of the way so they can see > what they are typing. A few people (like me) will even fill in forms without > ever having the mouse near an input element, by using the Tab key to > navigate through the form.
Good point, I didn't think of using tab, focus is definitely the way to go. However the unbinding of the keys is still a problem. I have the keys assigned to the document, so they can be used everywhere. Like so: $(document).keypress(function (e) { if(e.which == "120" || e.which == "100") { // do something } }); But when I focus (in this case) on an input field, textarea whatever, I want it disabled because it will perform the action if the person types in the specific key that is bound. > I wonder if this might be closer to what you're looking for: > > $('input').focus( function(){...} ).blur( function(){...} ); This logic should work perfectly, but now for the part in between the functions to unbind :) Thanks in advance. -- Jeroen