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 8339987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:02:36+00:00 2026-06-09T05:02:36+00:00

I would like to temporary disabling a click event on a JQuery element, bound

  • 0

I would like to temporary disabling a click event on a JQuery element, bound with jstree and Backbone.View.delegateEvents().

Below is how I process to do

before disabling the event, I record the event in a local variable using

self.defaultClick = $(this).data('events').click[0];

after, I disable the click event using

$(this).click(false);

Now I need to be bound again, I assign it back to the element using

$(this).data('events').click = self.defaultClick;

That works good, until the second time.

I get this error from JQuery.event.add ‘Object # has no method ‘push” at this line

handlers.push( handleObj );

The problem is ‘handlers’ becomes the event itself after the second assignment, while it s an array at the first assignment.

Any idea, how can I get around ?
either by avoiding reassign the event after being sure it s already bound, or may be using another way to assign the event ?

Thank you for your help.

EDIT

I am using jstree on this application.
I bound specific events on css class but, regarding the state of the application, I need to be able of disabling all the tree (including the class that are bound previously).

  • 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-06-09T05:02:37+00:00Added an answer on June 9, 2026 at 5:02 am

    Binding/unbinding a handler is expensive; why not just use a delegated event handler, set to run for a particular class name (e.g. .executeState) — then you can control whether or not to run the code simply by toggling the class: $(element).toggleClass('executeState');

    This way, only a single handler is bound, only once, to the document (or any parent element of the element you’re targeting).

    $(document).on('click', '.executeState', function() {
        // handler for click event
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a temporary table and I would like to create a temporary view
Would like a for loop in jquery so that: For every hover_link: show hidden
I would like to create a temporary table in a Oracle database something like
I would like to set up temporary ban system on my site to ban
I would like to know what's the difference when I write a temporary variable
In my GNUmakefile, I would like to have a rule that uses a temporary
I have the following url structure: www.mysite.com/temporary/articles.php?artid=1 I would like to change it with
I am writing a script that uses a temporary directory, and I would like
I would like to create a temporary dialog similar to the one Visual Studio
I would like to be able to make temporary drawings on top of my

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.