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

  • SEARCH
  • Home
  • 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 6943235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:07:46+00:00 2026-05-27T13:07:46+00:00

I am currently writing a custom context menu class which utilizes jQuery largely. We

  • 0

I am currently writing a custom context menu class which utilizes jQuery largely.

We call a function to assign a context menu to a particular element within the DOM. The assign function appends the necessary markup to the DOM, and then adds in keyboard support by adding a handler function to the $(document).keydown() method.

As soon as someone clicks on the document itself, the context menu is removed from the DOM. If the user then clicks on the element again, we add the markup to the DOM again, and re-assign the handler function.

The problem that I am facing is that the event handlers are added each time the user clicks the element. Is there a simple way with jQuery to remove the handler assigned to $(document).keydown() by the assign function only?

There are other functions within my script that also add listeners for the $(document).keydown() event, and I don’t want to remove all those functions – only those added by the context menu assignment script. Is this possible with jQuery?

  • 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-27T13:07:46+00:00Added an answer on May 27, 2026 at 1:07 pm

    I think on and off , using events names / namespaces to isolate handlers, should work.

    http://api.jquery.com/on/

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

Sidebar

Related Questions

I'm currently writing an custom control which has to hold child control and have
I am currently writing a small custom memory Allocator in C++, and want to
I'm currently writing a TYPO3 extension which is configured with a list of tt_content
I'm currently writing DataTemplate for my custom type lets say FootballPlayer. In this template
I'm currently writing a program in c# wpf with a custom window. So because
I'm writing a custom form UI and currently building a select box replacement. The
I am writing a custom tool and I currently have it doing what I
I am currently writing a few custom template tags but for some reason they
I'm currently writing a custom-designed tab control. I created my own control instead of
I'm currently writing a quick custom encoding method where I take a stamp a

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.