Speed up widget development with Sitefinity MCP server. Learn more...

Avoid conflicts when loading multiple versions of jQuery

By default, Sitefinity CMS uses a built-in copy of the jQuery library. In some cases you may require a different version of jQuery to support a JavaScript library written for a specific version. However, simply including a second version of jQuery may cause unexpected conflicts.

NOTE: To check the current version of jQuery, use the $.fn.jquery property.

To correctly include a version of jQuery that is different than the built-in version, you need to use the jQuery.noConflict() method to wrap your custom logic in a function scope and avoid conflicts:

After loading a second version of jQuery, calling the jQuery.noConflict(true) method restores the globally scoped jQuery variables to those of Sitefinity’s built-in jQuery library. In the code above, the variable jq14 is passed to a function scope. Inside that function scope, Sitefinity CMS version of jQuery is overridden and any code placed in the scope accesses the jQuery version you loaded.

For more information, see jQuery's documentation jQuery.noConflict.

NEW TO SITEFINITY?

Want to learn more?

Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.

Get started with Integration Hub | Sitefinity Cloud

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting your Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.

Was this article helpful?