You will need to get the original event handler, replace it with your own, and then call the original handler, however I'm not sure if this is possible using jQuery. Here is an example of using jQuery to access an element only, and then using βnormalβ JavaScript to install the handler:
// Wrapper in order not to add unnecceary variables to the global namespace (function (){ var link = $("a.clickyGoal1")[0]; var oldOnClick = link.onclick; link.onclick = function(e) { $("p.goal1").append("trial button click goal is fired"); oldOnClick(e); } })();
Rotora
source share