JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" onclick="myFunction(1, 2, 3);">Click Me</a>

JavaScript

window.myFunction = function(one, two, three) {
    console.log("one: " + one + ", two: " + two + ", three: " + three);
}
    
var wrapFunction = function(funcName) {
    var original = this[funcName];
    this[funcName] = function() {
        var event = arguments[arguments.length - 1]; 
        console.log(event);        
        original .apply(this, arguments);     
    }
}
  
$('[onclick]').each(function() {
    var s = $(this).attr('onclick');
    var firstIndex = s.indexOf('(');
    var lastIndex = s.lastIndexOf(')');
    
    var functionName = s.substring(0, firstIndex);
    wrapFunction.call(window, functionName);

    var s2 = s.substring(0, lastIndex);
    var s3 = s.substring(lastIndex, s.length);

    var s4 = s2 + ', event' + s3;
    
    $(this).attr('onclick', s4);
});