I'm having problems with a jQuery click event on a button inside a colorbox popup.
The button is as follows:
<div id="popup">
<button class="close_bu">Close</button>
</div>
Which by default has the following event:
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;
})
And I added:
jQuery('#popup').on('click','.returnBack',function(){
e.preventDefault();
})
But the new event attached to .returnBack does not work, and when I click the button, the close event is fired, it does not matter that the button does not have the .close_bu class, it continues to shell this event.
I'm a little confused: S
source
share