I know you're copying/pasting this from elsewhere in the document, but is there any way we could move this JS out of the template?  If this is out of scope for this PR, maybe create a JIRA ticket to track this as technical debt? 