Answer by Nasser Torabzade for Read the click event of the anchor tag in fancybox 2 title

you are binding an event to an element that does not exist at the time of binding the event, that's not gonna work. you need to bind your event to a parent element that exists when document is ready.

$(PARENT_ELEMENT).on("click","#tb2fb",function(){
      alert("RIP");
});

safest way is to use body as PARENT_ELEMENT in above code.

Leave a Reply

Your email address will not be published. Required fields are marked *