Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code for logging events on an object
$obj = $('input');
function getEventsList($obj) {
var ev = new Array(),
events = $obj.data('events'),
i;
for(i in events) { ev.push(i); }
return ev.join(' ');
}
$obj.on(getEventsList($obj), function(e) {
console.log(e.type);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment