i have a problem with the right-click-contextmenu
i try to delete a div
$(".global_class").live('mousedown', function(e)
{
if( (e.which == 3) )
{
// $('#'+this.id+'').remove();
del_function(this.id);
}
e.preventDefault();
}).live('contextmenu', function(e){ e.preventDefault(); });
This code works but the problem is the $('#'+this.id+'').remove();
jquery removes the div and the live $(".global_class").live('mousedown', function(e) didn’t start (result -> the context menu will not be blocked).
Hope someone can help me.
Thanks in advance!
Peter
When you remove the elements that are involved in an event, results in terms of bubbling and defaults and such get a bit squirrelly (even without jQuery’s
livebeing involved). You could do this:…so that you remove the
divimmediately after the event finishes, rather than during the event.Off-topic, but you can’t cancel the
contextmenuevent on all browsers (Opera comes to mind), which you may want to factor into your UI decisions…