Skip to content

Instantly share code, notes, and snippets.

@mephraums
Created January 13, 2014 08:20
Show Gist options
  • Save mephraums/8396494 to your computer and use it in GitHub Desktop.
Save mephraums/8396494 to your computer and use it in GitHub Desktop.
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