Quick Tip: Adding jQuery to MOSS Publishing Pages

When enhancing MOSS publising pages using jQuery, I hit the following speed bump:

Server Error in ‘/’ Application.


Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls.

Source Error:

 
Line 10: 
Line 11: 
Line 12: <script 
Line 13:     type="text/javascript" 
Line 14:     src="/jQuery/jquery-1.4.min.js"> 

Source File: /_catalogs/masterpage/KCC_FacultyMember.aspx    Line: 12


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

It was easy enough to fix (h/t to my colleague, Uday Ethirajulu).  Be sure that the jQuery code lives inside the “PlaceHolderAdditionalPageHead” as shown:

<asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server">

<script

    type="text/javascript"

    src="/jQuery/jquery-1.4.min.js">

</script>

<script type="text/javascript">

  $(document).ready(function() {

   // Brilliant jQuery stuff goes here.

   });

</script>

</end>

Subscribe to my blog.

Follow me on Twitter at http://www.twitter.com/pagalvin

One thought on “Quick Tip: Adding jQuery to MOSS Publishing Pages

Leave a Reply

Your email address will not be published. Required fields are marked *