live-event
Version:
Live event binding in the DOM using plain JavaScript.
44 lines (30 loc) • 833 B
Markdown
Live event binding in the DOM using plain JavaScript. This repo is based on this article http://stackoverflow.com/questions/9106329/implementing-jquerys-live-binder-with-native-javascript and all credit goes to OP.
```
npm install live-event
```
With [browserify](http://browserify.org/) or [webpack](https://webpack.github.io/):
```
var live = require('live-event');
live('click', '.target', function (event) {
console.log(event);
});
```
`live(eventType, querySelector, callback) -> undefined`
Required
Tpye: `String`
A DOM event.
Required
Type: `String`
A `querySelector` String.
Required
Type: `Function`
Event handler function.
http://caniuse.com/#search=querySelector