How do I run custom JavaScript in an HTML element?

How do I run custom JavaScript in an HTML element? The tag exists in my code but doesn’t execute at runtime.”

This code operates outside of the FM Betterforms / Klai environment but not when pasted into a FMB page.