I'm trying to debug a click event in an element with JQuery, to know why the element sometimes reproduces the click event and sometimes doesn't.
The main question is why, if i set a debugger breakpoint INSIDE the click event function, if i debug what does "this" keyword has inside the body of the function, it does have "onclick = null"... But hasn't "this" (aka "currentTarget") just fired the click event? So why does it have "onclick = null"?
Here is the piece of code where the debuggers are:
container = $("#PosterContainer");
container.find("#PosterBody").html(data);
container.hide();
container.fadeIn({ queue: false, duration: 300 });
container.find("#PosterExit").on("click", function (element) {
debugger
var el = this; //Here "el" has "onclick = null"
container.fadeOut();
});
debugger //Here "#PosterExit" has "onclick = null"