There are a few common reasons TrustedForm isn't injecting correctly.
1) The code is in the wrong location.
2) The form has not yet loaded on the page.
The script runs when the page loads, but in some cases, the form is injected later and does not yet exist (e.g. DOM injected into a modal window).