I am relatively new to jQuery but the below code seems logical but is not working as I would expect. I am utilizing the Colorbox jQuery plugin.
My intention is to only add a listener for the 'cbox_closed' event on 'a' elements who have an id that contains 'Remove'. Unfortunately, as presently implemented this adds the listener on all raisings of the 'cbox_closed' event.
Am I missing something or is this not a valid means of adding an event listener?
$('a[id*="Remove"]').bind('cbox_closed', function() {
var row = $($.fn.colorbox.element()).parents('tr');
row.fadeOut(1000, function() {
row.remove();
});
});