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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:44:27+00:00 2026-05-17T01:44:27+00:00

I have a toolbar that manipulates a Google map. Some of the functions affect

  • 0

I have a toolbar that manipulates a Google map. Some of the functions affect markers placed on the map. I have a reset button that clears the changes and returns the map to the original state.

I need to “disable” the reset button until the map is changed. So…

  1. When an action is completed that manipulates the map, I bind the ResetMap() function to the reset button.
  2. Reset button is clicked and returns the map to original state.
  3. Reset button action is unbound again.

However, I can’t get step 3 to work. I tried to unbind the event at the end of the ResetMap() function like so:

function ResetMap(){
 var Wrapper = $("#page_layout").find("#InlineToolbarMessages");
 if(Wrapper.hasClass('isExpanded')){
  Wrapper.removeClass('isExpanded');
  Wrapper.addClass('isCollapsed');
 }
 $("#page_layout").find('#NumSelectedNumber').html("0");
 $("#page_layout").find('div#SelectedVoters').html("");
 clearMarkers();
 $('#page_layout').find('#reset_button').unbind('click', function(){
  ResetMap();
 });
}

I also tried a more global:

$('#page_layout').find('#reset_button').unbind();

without success. What am I doing wrong?

  • 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-17T01:44:28+00:00Added an answer on May 17, 2026 at 1:44 am

    Edit: Based on your comment that you “…found out that if [you] did $('#reset_button').unbind('click'); before [you] called the `ClearMarkers()“ function that it worked. Similarly in another function for a different button, [you] put the unbind at the beginning and it worked.”:

    That makes me think that either A) The code earlier is throwing an exception, preventing your getting to the unbind call at all, or B) The code earlier is removing the reset_button button or adding another one with the same ID (which will make the document invalid and the behavior of an ID selector indeterminate).


    Original Answer

    Change

    $('#page_layout').find('#reset_button').unbind('click', function(){
        ResetMap();
    });
    

    to

    $('#page_layout').find('#reset_button').unbind('click', ResetMap);
    

    …assuming you used ResetMap in the bind call. Since you haven’t shown the bind, it’s hard to say for certain.

    When you call unbind with a function reference, it has to be the exact same function reference that you gave bind (or one of bind‘s shortcuts, click and such).

    So for instance, this works:

    // Binding
    $("#myElement").bind("click", myFunction);
    
    // Unbinding
    $("#myElement").unbind("click", myFunction);
    

    …but this does not work:

    // Binding
    $("#myElement").bind("click", function() {
        myFunction();
    });
    
    // Unbinding
    $("#myElement").unbind("click", function() { // <== Does not work
        myFunction();
    });
    

    …because the function references are not the same.

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

Sidebar

Related Questions

I want to have a button on my toolbar that has a little down
I have a ControlTemplate that is made up of a ToolBarTray and a ToolBar.
I have written a toolbar that runs on the taskbar. Unfortunately, after it is
I have a 'toolbar' div that I made resizable via jQuery UI. The weird
I have written an Application Desktop Toolbar (a.k.a AppBar), it works great except for
Do anyone have good ideas of how to modify the toolbar for the WinForms
I have a UINavigationController. In its toolbar is a segmented control with two buttons.
I am writing a toolbar for IE(6+). I have used the various sample bars
Have just started using Google Chrome , and noticed in parts of our site,
I have developed a Firefox toolbar in XUL, which uses javascript to manipulate the

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.