Reputation: 1577
I want to evaluate the activities on an input:
$('#foo').keyup(function(e) {
e.preventDefault();
e.stopPropagation();
$('#foo').after('<p>Keyup detected</p>');
if (e.keyCode == 13) {
$('#foo').after("<p>'Enter' detected</p>");
}
});
It works fine on Chrome, but on FF and IE the event seems to be fired twice. Why? How can I prevent them from doubling the event? (see http://jsfiddle.net/Robbit/nrsos4gh/9/)
Solved - The reason was the running tool PhraseExpress, which should track for certain key combinations. Sorry for the fuss, but thanks for the helpful informations and the checks on your devices, which eventually lead me to the actual cause.
Upvotes: 0
Views: 764
Reputation: 7301
Your code only fires once for me in IE11 & FF35 on Windows 7.
However when I have had similar issues in the past the following has fixed the issue for me.
Unbind any other events.
$('#foo').unbind();
Disable autocomplete on the text field.
<input id="foo" type="text" autocomplete="off">
Upvotes: 2