<p>Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is handled by the controller. </p>

<p>I bind some <code>onclick</code> events to a button, but I find that they sometimes execute in an order I did not expect. </p>

<p>Is there a way to ensure order, or how have you handled this problem in the past?</p>

If order is important you can create your own events and bind callbacks to fire when those events are triggered by other callbacks.
```
```
$('#mydiv').click(function(e) {
    // maniplate #mydiv ...
    $('#mydiv').trigger('mydiv-manipulated');
});

$('#mydiv').bind('mydiv-manipulated', function(e) {
    // do more stuff now that #mydiv has been manipulated
    return;
});
```
```
Something like that at least.