Issues In finding the body tag in the source code of template to add the Javascript code

Aakash Chandak asked on April 21, 2015 23:42

Could you please guide me that where can I find the body tag in the templates so that I can go ahead and add the Javascript code in it.

Recent Answers


Brenden Kehren answered on April 21, 2015 23:54

If you're using portal mode, I'd suggest NOT making this change as it could cause problems when upgrading. What you can do is in your master page in the template layout add a page load event and set the body css like this:

    <script runat="server"> 
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.DataBind();
            CMS.DocumentEngine.DocumentContext.CurrentBodyClass += " yourBodyClass";
        }
    </script>
0 votesVote for this answer Mark as a Correct answer

Chris Lo answered on April 23, 2015 01:32 (last edited on April 23, 2015 01:34)

Is it javascript code or css you're trying to put into the body tag?

If it's javascript, you should put it into the header section, and there's a tab on each template where you can do that. If you want it to run on every page, do it in the master template, otherwise do it just on the template(s) for the pages you want it to run on.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.