OnEventHeaderItem uses function Wicket.Event.add from wicket-event-jquery.js to bind a script to specific event fired for a given DOM element.
The function allows to specify the DOM element using its id. In this case the element is retrieved with standard function document.getElementById.
However, this scenario fails when we apply it through OnEventHeaderItem because Wicket.Event.add is invoked before the DOM is ready (see attached quickstart). Therefore, we should modify the function to check for DOM-ready state (see attached patch).