addClass and removeClass in jQuery – not removing class

What happens is that your close button is placed inside your .clickable div, so the click event will be triggered in both elements. The event bubbling will make the click event propagate from the child nodes to their parents. So your .close_button callback will be executed first, and when .clickable is reached, it will toggle … Read more