bind-on-events
v1.0.5
Published
bind elment events by xbn-on-xxx attributes
Downloads
8
Readme
Install with npm
:
npm i --save bind-on-events
How to use
jQuery is required.
<a onClick="letSee(1,2)">click and see</a>
should require you define letSee function as scope. In jquery, you can bind click event to your function like this
$('a').on('click', function() {
});
so with bind-on-events, you can do it like this
var bindEvents = require(' bind-on-events');
var service = {
letSee: function(a, b) {
}
}
bindEvents($('a'), service);
and html like this
<a xbn-on-click="letSee(1,2)">click and see</a>
Event supported
xbn-on-click
xbn-on-blur
xbn-on-enter
xbn-on-change