I am trying to hide some javascript code from inspect page element.
For example I have HTML widget as:
Impossible at all.
You've sent a script element to the client. The inspector is running in the same scope with the same permissions as your script.
You can obfuscate it (if you really need to).