dom-listeners

DOM listeners made easy

npm install dom-listeners
2 downloads in the last week
4 downloads in the last month

dom-listeners

DOM Event listeners made easy.

Installation

npm install dom-listeners

API

// Simple listener
var on = require('dom-listeners/listener'),
    byId = require('dom-essentials/by').id;

var someEl = byId('some-id');

on(someEl, 'click', function(e) {
    // Event listening!
});

// Delegation
var delegate = require('dom-listeners/delegation');

delegate(document, 'click', 'li', function(e) {
    console.log(this.nodeName); // "LI"
});

Contributors

License

MIT License.

npm loves you