I've known about the bind and trigger methods for a while now, but I've never really bothered with them until tonight.
I've been developing a 'add to select' plugin that allows you to dynamically add a new element to the select list, and that also ajax submits the new item. Anyway I needed a way to externally open and close the new item form. Externally the code looks something like this.
$('select').trigger('closeForm');
From within my plugin I have dynamically binded the closeForm event to a internal function that handles closing the form and tidying things up.
My code sample is something like this:
$('select').bind('closeForm', function() {
// logic to run to close form
});
All i did was add the trigger code above to an external button to close the form dynamically. Sweet!