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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:15:42+00:00 2026-06-04T10:15:42+00:00

Im having problems with jQuery click event on a button inside a colorbox popup.

  • 0

Im having problems with jQuery click event on a button inside a colorbox popup.

The button is the following:

<div id="popup">
    <button class="close_bu">Close</button>
</div>

Which by default have the following event attached:

jQuery('.close_bu').bind('click',function(){        
            jQuery.colorbox.close();
});

When i fire another event i want to change the default behavior so i do the following:

jQuery('#anotherpopup').on('click','.deleteplan_button',function(){

            jQuery('#popup .close_bu').addClass('returnBack');
            jQuery('#popup .returnBack').removeClass('close_bu');

            jQuery.colorbox({inline:true , href:"#popup", opacity: 0.6, width: "600px"});
return false;
         })

An i have added :

jQuery('#popup').on('click','.returnBack',function(){
                e.preventDefault();
                //Do something
})

But the new event attached to .returnBack is not working and when i click the button is firing the close event , it doesnt matter that the button dont have the .close_bu class anymore, it keep firing that event.

Im a bit confused :S

  • 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-04T10:15:43+00:00Added an answer on June 4, 2026 at 10:15 am

    In your code there is no element with the id popup. So jQuery('#popup') will do nothing (or you haven’t shown us vital parts of the code).

    Update:

    you will need to use .unbind() instead of removing the class

    $('#popup .close_bu').unbind('click');
    

    by '#popup .close_bu' you just select the element you want to wire up with the event, or in this case unwire from the event. The jQuery css selector just looks like css. The connection between the event and the handler doe not use css.
    The whole trick of adding and removing classes is to trigger different css styles, it will only alter the appearance of an elment, but it won’t change events.

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

Sidebar

Related Questions

I'm having some trouble with an Ajax script which disables my jQuery click events.
i am having a problem when i click on an input(button) (click event captured
I am having problems with my JQuery returning null. Here is my JQuery (which
I'm having some problems with Jquery UI Dialog and TinyMCE. Passing data to a
I am having problems with the Jquery qtip plugin. It works fine in Firefox
I am having problems getting the JQuery Library Rounded Corners to work in IE.
Hi I'm having some problems with jquery checkbox selected. I want to do a
I'm having problems with understanding how jQuery create headers for ajax post. I have
I am new to jquery mobile, and am having problems getting content I have
I am using the jQuery UI components but having some problems. If I try

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.