Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4252840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:52:10+00:00 2026-05-21T04:52:10+00:00

i have a problem with the right-click-contextmenu i try to delete a div $(.global_class).live(‘mousedown’,

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:52:11+00:00Added an answer on May 21, 2026 at 4:52 am

    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 live being involved). You could do this:

    $(".global_class").live('mousedown', function(e)
    {
        var id = this.id;
    
        if( (e.which == 3) ) 
        {
           setTimeout(function() {
                del_function(id);
           }, 0);
        }
        e.preventDefault();
    }).live('contextmenu', function(e){  e.preventDefault(); });
    

    …so that you remove the div immediately after the event finishes, rather than during the event.


    Off-topic, but you can’t cancel the contextmenu event on all browsers (Opera comes to mind), which you may want to factor into your UI decisions…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Contextmenu with a ListBox inside. Whenever I right click my control
I have a very serious problem with Visual Studio 2008. Occasionally when I right-click
I have problem when I try insert some data to Informix TEXT column via
I have a problem using the Java search function in Eclipse on a particular
I have a problem with a little .Net web application which uses the Amazon
I have a problem in my project with the .designer which as everyone know
I have a treeview showing Categories and subcategories. I need to Right Click Option
I have created a ShellExtension which add Start N Application to the windows right
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with return statment >.< I want to store all magazine names

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.