When using Sitecore's Web Forums for Marketers (WFFM) module, do you ever face issues with conflicting versions of jQuery? If so, then I have an easy solution for you. Use the jQuery.noConflict()
method, provided by jQuery Core OOTB.
The call should look something like the following:
$.noConflict();
If you have a solution where you do not have include the WFFM module's JS on every page and jQuery.noConflict()
is causing issues on pages where only one version of jQuery has been loaded, then there's a solution to that too!
Fortunately, jQuery registers itself as an AMD module, so you can check to see if jQuery is already loaded on the page before you call jQuery.noConflict()
. To do this, wrap the call to jQuery.noConflict()
in the following condition:
if (typeof window.jQuery != 'undefined') {
$.noConflict();
}
If you're wondering where you should put this script, it may vary by solution but it ordinarily belongs at the top of a handler/code-block that is fired on window load, and should be one of the first things to run.