For Craft installs 2.4.2688 or later, see Sam Hibberd's answer!
@AaronBerkowitz is correct – unfortunately there's no way, currently.
Here's a workaround, which uses
setInterval to poll the elementselects in the DOM for changes. If any of the elementselects have changed, the container will trigger a custom
elementselectchange event, which you can listen for:
This is hardly an elegant or best practice solution, but in this case it's the best I can think of. Instead of polling it might be better to bind a click listener to the elementselect's add/delete buttons, however as elementselects can exist in so many different contexts, writing a reliable event listener is really tricky. In any case, should P&T add a "elementChange" event or the like down the line, you'd likely be able to rip out the poller and keep your event handler.
The code in the Gist can be copy pasted as-is to a JS file and added to the Craft CP like this (in your plugin's main class):
if (!craft()->request->isAjaxRequest() && craft()->request->isCpRequest())
The test for AJAX requests is important, if you leave it out the script will execute every time an Assets modal opens etc, which will make your event handlers fire multiple times.