keypress event not being triggered only at start and end of text field in Firefox (JQuery)

Posted by rlivsey on Stack Overflow See other posts from Stack Overflow or by rlivsey
Published on 2010-05-05T22:11:41Z Indexed on 2010/05/05 22:18 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

I'm listening for keypress events on an input field with delegation. For some reason, Firefox doesn't trigger the delegated event for cursor UP when at the start of the field, or cursor DOWN when at the end. LEFT and RIGHT work as expected all the time.

Directly binding an event listener to the field works fine, so it has to be something to do with delegation. Does anyone know if this is a know issue, I couldn't find anything on Google/forums etc..?

$("div").delegate(":input", "keypress", function(e){
  // doesn't get triggered
});

$("div :input").bind("keypress", function(e){
  // gets triggered fine
});

Here's a demo which shows the issue - http://livsey.org/jquery.delegation.html

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery