Skip to content

Instantly share code, notes, and snippets.

@gregorymostizky
Created April 13, 2011 13:44
Show Gist options
  • Save gregorymostizky/917568 to your computer and use it in GitHub Desktop.
Save gregorymostizky/917568 to your computer and use it in GitHub Desktop.
Bind and trigger custom events for specific element
var self = $('#mydiv');
// define
self.unbind('my-event');
self.bind('my-event', function() {alert('yes')});
// trigger
self.trigger('my-event');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment