In a recent blog entry, we explained how to add custom code to ribbon buttons and how to cancel the event bubbling. This works for the majority of buttons, but doesn't work for the Preview Merge Results button, because of an anonymous Javascript function.

In this case, the complete node must be cloned to remove the event handlers. Then, all the required events can be rewired. The following code uses jQuery to store the parent node, clone the button and to append it to the parent element.


Happy coding!