-
Access to javascript events is not supported in the ui widgets. You can read through this post for an explanation and examples of things that might be possible, especially the advanced javascript section.
-
This:
is not how OH actions work. Actions are a specific feature of some of the oh components and can only be configured for those components. They are not a general js function.
Overall, this smells a little like an XY problem. If you explain what you are actually trying to accomplish there may be a more native way to solve the problem.