Event targets
by evild70
HTML
<button class="btn">Click me</button>
<div class="fakebtn">
<div class="txt">Click me</div>
</div>
CSS
.fakebtn {
background-color: #EEEEEE;
margin: 10px 0;
padding: 10px;
}
.txt {
background-color: #90EE90;
width: 50%;
}
JavaScript
$('.btn, .fakebtn').on('click', function(e) {
console.log('type: ' + e.type);
console.log('target: ' + e.target);
console.log('currentTarget: ' + e.currentTarget);
});