delegate

Lightweight event delegation

delegate

Lightweight event delegation.

You can get it on npm.

npm install delegate --save

Or bower, too.

bower install delegate --save

If you're not into package management, just download a ZIP file.

var delegate = require('delegate');
<script src="dist/delegate.js"></script>
delegate(document.body, '.btn', 'click', function(e) {
    console.log(e.delegateTarget);
}, false);
var delegation = delegate('.btn', 'click', function(e) {
    console.log(e.delegateTarget);
}, false);
 
delegation.destroy();
Latest ✔ Latest ✔ IE 9+ ✔ Latest ✔ Latest ✔

MIT License © Zeno Rocha