# Disabling jQuery from the Google CDN creates TypeError: Property '$'

**URL:** https://discourse.roots.io/t/disabling-jquery-from-the-google-cdn-creates-typeerror-property/817
**Category:** uncategorized
**Created:** 2013-11-27T20:02:54Z
**Posts:** 7

## Post 1 by @ryan — 2013-11-27T20:02:55Z

Inside config.php there is an option to disable loading jQuery from the Google CDN. If this is done, developer tools catches an error inside scripts.min.js

```
Uncaught TypeError: Property '$' of object [object Object] is not a function
```

The reason for not using Google CDN is that I need to fully support the jQuery included with WordPress.

I’ve tested this on the latest version of Roots (6.5.1) and the latest install of WordPress (3.7.1). Fresh installs, no plugins.

Is this a bug or is there something I need to do in addition to commenting out:

```
//add_theme_support('jquery-cdn');
```

… inside config.php

---

## Post 2 by @ben — 2013-11-27T22:31:27Z

Ahh, that’s because WordPress uses jQuery in noConflict mode. You’d have to edit `_main.js` to replace `$` with `jQuery`. We should probably fix this in the repo…

edit:

ps. the WordPress jQuery version is the same as the one we load from the Google CDN. What do you mean by you need to fully support the included jQuery? You shouldn’t run into conflicts

---

## Post 3 by @ben — 2013-11-27T23:04:17Z

To be more specific, update the last line in `_main.js` to be `jQuery(document).ready(UTIL.loadEvents);` and then change the `$.each` in that file to `jQuery.each`

---

## Post 4 by @ryan — 2013-11-28T00:23:22Z

Thanks Ben. We are using Roots as a boilerplate for theme development and the market place (Envato) has a strict policy not to use deregister to load anything other than the default version of jQuery.

```
Authors are not allowed to deregister the default version of jQuery and load another one.
```

There are arguments on both sites of this policy but for now we need to follow the guidelines or our theme will not be accepted. I’m sure other theme authors are doing the same thing - disabling jquery-cdn, even though it’s good coding.

Thanks for looking into that.

---

## Post 5 by @ryan — 2013-11-28T00:25:41Z

Here is the reference to the policy in case you are interested.

[Envato Policy RE: deregister default version of jQuery](http://support.envato.com/index.php?/Knowledgebase/Article/View/472/85/wordpress-theme-submission-requirements)

---

## Post 6 by @stueynet — 2014-01-31T15:56:14Z

This is an important issue. The version of jquery loaded via roots is fixed so if that changes in WP it doesn’t mean it changes in all the roots based themes we have built. Disabling theme support in config is a good feature but the whole structure of \_main.js should really be changed to no conflict mode. I have read about changing the wrapper to allow for normal jquery to be run in no conflict mode but I have not been able to get it work correctly. Does anyone have a solution where we can still use the \_main.js wrapper but in no conflict mode?

---

## Post 7 by @stueynet — 2014-01-31T15:59:26Z

And now I see this has already been handle in the latest update. Please ignore.
