tags:

views:

16

answers:

2

Hi, it is possible to bind Live('hover') and bind('contextmenu') on the same .class?

This code dont work

$('.too').bind("contextmenu", function(e) {
    e.preventDefault();
    $('#ttt').append('click ' + this.id + '<br />');
});

$('.too').live('hover', function(event) {
    $('#ttt').append('click ' + this.id + '<br />');
}
});

here is a working example http://jsfiddle.net/CD5tX/15/

Thanks in Advance Peter

A: 

may I ask what you are trying to do?

Cause on the looks of it you are binding a custom event which is named contextmenu. If you try to trigger it (on click for example) it will work.

like this,

$('.too').bind("contextmenu", function(e) {
    e.preventDefault();
    $('#ttt').append('click ' + this.id + '<br />');
}).click(function(){
    $(this).trigger("contextmenu");
});
Reigel
+1  A: 

You have a syntax error (an extra } character), it seems to work when that is fixed.

see http://jsfiddle.net/CD5tX/17/

Shrikant Sharat