Skip to content

Instantly share code, notes, and snippets.

@jewel-andraia
Created September 20, 2013 14:58
Show Gist options
  • Save jewel-andraia/6638823 to your computer and use it in GitHub Desktop.
Save jewel-andraia/6638823 to your computer and use it in GitHub Desktop.
A Pen by Anonasaurus Rex.
<ul>
<li>
<div><span>Click</span> 1</div>
</li>
<li>
<button>Click 2</button>
</li>
<li>
<button>Click 3</button>
</li>
<li>
<button>Click 4</button>
</li>
</ul>
<div id="clicked"></div>
$('ul').on('click', 'button, div', function(e) {
var info = [
'this: ' + this.tagName,
'target: ' + e.target.tagName,
'currentTarget: ' + e.currentTarget.tagName,
'delegateTarget: ' + e.delegateTarget.tagName,
].join('<br>');
debugger;
$("#clicked").html(info);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment