icecats11 / js-hotkeys

Automatically exported from code.google.com/p/js-hotkeys
0 stars 0 forks source link

js-hotkeys doesn't seem to work with jquery live events #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Bind a keypress, keydown, or keyup event to a jquery live event
2. Bind a js-hotkeys event
3. Only one of the events will fire or neither

What is the expected output? What do you see instead?
Even when live key events are bound, js-hotkeys should still work.

What version of the product are you using? On what operating system?
0.7.8

Please provide any additional information below.  Here's the code I'm
trying to get to work:
    // this was existing working code
    $('#contentInner #main .txtRequisition').live('keypress', function(e) {
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
            alert('enter pressed');
            return false;
        }
        return true;
    });

    // here's the 2 js-hotkeys events i added.  if i comment-out the
    // live handler, these work, but not otherwise.
    $(this).bind('keydown', 'f5', function(evt) {
        alert('f5');
        return false;
    });

    $(this).bind('keydown', 'Ctrl+r', function(evt) {
        alert('Ctrl+r');
        return false;
    });

Original issue reported on code.google.com by gabriel....@gmail.com on 20 Feb 2009 at 11:06

GoogleCodeExporter commented 8 years ago
live event brings a new interface toward binding/unbinding (live and die).

quoting from http://docs.jquery.com/Events/live

#  Live events do not bubble in the traditional manner and cannot be stopped 
using
stopPropagation or stopImmediatePropagation. 

Original comment by Afro.Sys...@gmail.com on 3 May 2009 at 12:06