On Wed, Dec 17, 2008 at 2:31 PM, sshefer <shai.she...@gmail.com> wrote:
>
> Here is my current code:
>
>        $('.position_info').hover(
>          function(e) {
>                var target = $(e.target);
>            target.bind('keydown', 'space', function(){
>                  target.children('strong').toggle();
>                });
>          },
>          function(e) {
>                var target = $(e.target);
>                target.unbind('keydown', 'space');
>          }
>        );
>

the target.bind('keydown', 'space', ... won't work because you have to
pass an object. Similarly, unbind() takes an event type and a
function. You'll need to figure out which key has been pressed in your
handler function.

I'd do something more like this (yeah, I tested it and it doesn't work
but, anyway ...)

$('.position_info').hover(
        function(e)
        {
                var target = $(e.target);
                target.bind(
                        'keydown',
                        {combi:'space', disableinInput: true},
                        handler
                );
        },
        function(e)
        {
                var target = $(e.target);
                target.unbind('keydown');
        }
);

function handler(e)
{
        var target = $(e.target);
        target.children('strong').toggle();
        alert(e.data.combi);
}

Good luck.

Reply via email to