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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:30:02+00:00 2026-05-16T05:30:02+00:00

Maybe I’m totally missing something about even handling in jQuery, but here’s my problem.

  • 0

Maybe I’m totally missing something about even handling in jQuery, but here’s my problem.

Let’s assume there are some event binding, like

$(element).bind("mousemove", somefunc);

Now, I’d like to introduce a new mousemove binding that doesn’t override the previous one, but temporarily exclude (unbind) it. In other words, when I bind my function, I must be sure that no other functions will ever execute for that event, until I restore them.

I’m looking for something like:

$(element).bind("mousemove", somefunc);
// Somefunc is used regularly
var savedBinding = $(element).getCurrentBinding("mousemove");
$(element).unbind("mousemove").bind("mousemove", myfunc);
// Use myfunc instead
$(element).unbind("mousemove", myfunc).bind("mousemove", savedBindings);

Of course, the somefunc is not under my control, or this would be useless 🙂

Is my understanding that is possible to bind multiple functions to the same event, and that the execution of those functions can’t be pre-determined.
I’m aware of stopping event propagation and immediate event propagation, but I’m thinking that they are useless in my case, as the execution order can’t be determined (but maybe I’m getting these wrong).

How can I do that?

EDIT: I need to highlight this: I need that the previously installed handler (somefunc) isn’t executed. I am NOT defining that handler, it may be or may be not present, but its installed by a third-party user.

EDIT2: Ok, this is not feasible right now, I think I’m needing the eventListenerList, which is not implemented in most browsers yet. http://www.w3.org/TR/2002/WD-DOM-Level-3-Events-20020208/changes.html

  • 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-16T05:30:03+00:00Added an answer on May 16, 2026 at 5:30 am

    Another way could be to use custom events, something along these lines:

    var flag = 0;
    $(element).bind("mousemove", function() {
        if(flag) {
            $(this).trigger("supermousemove");
        } else {
            $(this).trigger("magicmousemove");
        }
    }).bind("supermousemove", function() {
        // do something super
    }).bind("magicmousemove", function() {
        // do something magical
    }); 
    
    $("#foo").click(function() {
        flag = flag == 1 ? 0 : 1; // simple switch
    });
    

    Highly annoying demo here: http://jsfiddle.net/SkFvW/

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

Sidebar

Related Questions

Maybe I'm just thinking about this too hard, but I'm having a problem figuring
Maybe the need to do this is a 'design smell' but thinking about another
Maybe this is a dumb question, but is there any way to convert a
Maybe world peace would be easier, but I have a problem with the widths
Maybe I just don't know .NET well enough yet, but I have yet to
Maybe my understanding of agile development isn't as good as it should be, but
Maybe this is a dumb question, but I have the following behavior in Visual
Maybe this cannot be done, but please help or suggest how this can be
Maybe this applied to other Delphi's (I've only used 7). We've got our code
Maybe this is an overarching question as I've seen similar bugs in Firefox and

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.