[jQuery] event bubbling - checking for the right element
Hi,
I've got a problem with event bubbling.
That works fine:
$(function() {
$("body").click(function(e) {
if ($(e.target).is("h2")) {
alert("Test");
}
});
});
But now I want something like that:
$(function() {
$("body").click(function(e) {
if ($(e.target).is("#test h2")) {
alert("Test");
}
});
});