How to register and use the native Kentico jQuery library

Do you know that Kentico CMS has a built-in jQuery library? This article provides you with some details on how to correctly implement jQuery into your website, to avoid any conflicts with other JavaScript libraries.
Please add the following code into the layout of your master page template:

<script runat="server"> protected void Page_Load(object sender, EventArgs e) { CMS.GlobalHelper.ScriptHelper.RegisterJQuery(this.Page); } </script>

You then need to access DOM objects with $jQuery option.  Since Kentico uses jQuery for some of our web parts, the jQuery core is already registered.  You can find the physical file in the following location: <web site folder>\CMSScripts\jquery\jquery-core.js
Note: You will need to ensure that your jQuery is not loaded/executed in the Kentico UI, in order to avoid interaction with the native Kentico jQuery scripts which ensures the default functionality of the UI.


See also: jQuery.noConflict(), How to use jQuery with native Kentico web parts

Applies to: Kentico CMS 6.x and 7.x
Share this article on   LinkedIn

Martin Danko

Let me guide you on your journey of success. I will show you how to optimize your content production with Kentico Draft. Check out