Skip to main content

JS In No Conflict Mode – Solving Inherited Errors

By December 12, 2018March 5th, 2021Web Development development

Here’s a post for newbies. Every now and then you’ll inherit some random web project where your trying to modernize the look but your stuck in an archaic platform with no easy upgrade path.

In my case, Magneto v1. I was trying to add bootstrap on top of that ancient platform and soon discovered that none of the internal JS included was running in no-conflict mode.

Basically anytime you’ve got jQuery, Prototype.js, Mootools js, or BootStrap running in some convoluted mess of code, you’re probably going to get namespace errors in the DOM.

I have fixed many errors with this simple line of code:

<script type="text/javascript">$.noConflict();</script>

Insert either right before the closing /html tag in the footer, or below all your included scripts in the header.