I'm afraid this video is one for the code geeks :) One common issue with putting JS in a Code block for an Element saved as a template is that if it is added to the editor more than once, you need to ensure the code does not run more than once and cause issues. This video shows a method I have started to use which tracks instances of the code and prevents running multiple times.