Skip to content
Advertisement

Input Fires Keypress Event Twice

This question has been asked/answered (mostly) before, BUT I’ve tried three things to stop the event from bubbling but nothing has worked:

JavaScript

(return false should take care of the other two, correct?)

Here’s the html:

JavaScript

And the JS (UPDATE CLEANED UP):

JavaScript

});

I left the redundant stoppers in there but really shouldn’t return false simply kill the bubbling? (using Chrome).

Clue? keyCode=13 is “Enter”

Advertisement

Answer

Wow. Your help was great and helped me think it through.

BUT the solution feels a bit like a cop-out; effective, but the condition should never be there in the first place.

Here it is, which I found in the comments from here: http://yuji.wordpress.com/2010/02/22/jquery-click-event-fires-twice/

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement