Would like to suggest to change the code from extraParams[key] = typeof param == "function" ? param() : param;
to extraParams[key] = typeof param == "function" ? param.apply(input) : param; Then the extraParam function is able to use 'this' to locate the DOM node, similar as "result" event handler.