One idea: have a look at the Aspect Oriented Programming plugin. See http://plugins.jquery.com/project/AOP and http://code.google.com/p/jquery-aop/
If this isn't exactly what you are looking for, then therin is code to pre- and post-hook existing events. I hope this helps. **--** Steve On Sep 14, 1:05 pm, sirrocco <xavier...@gmail.com> wrote: > Here's what I'm trying to do : > > I have a page with some links. Most links have a function attached to > them on the onclick event. > > Now, I want to set a css class to some links and then whenever one of > the links is clicked I want to execute a certain function - after it > returns , I want the link to execute the onclick functions that were > attached to it. > > Is there a way to do what I want ? > > Here's an attempt at an example : > > $("#link").click(function1); > $("#link").click(function2); > $("#link").click(function(){ > firstFunctionToBeCalled(function (){ > // ok, we're inside the callback - now execute function1 and > function2 > }); > > }); // somehow this needs to be the first one that is called > > function firstFunctionToBeCalled(callback){ > // here some user input is expected so function1 and function2 > must not get called > callback(); > > } > > All this is because I'm asked to put some confirmation boxes (using > boxy) for a lot of buttons and I really don't want to be going through > every button.