Title: Jquery issue
Last modified: May 29, 2018

---

# Jquery issue

 *  [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/)
 * Hi
 * I have been developing several plugins for WPress without any trouble. I have
   been introducing the jquery lib directly on the skeleton pages, like this:
 * <script src=”<? echo plugins_url(‘myPlugin’) ?>/js/jquery.min.js”></script>
    
   <script src=”<? echo plugins_url(‘myPlugin’) ?>/js/jquery-ui.min.js”></script
   >
 * It all went well until I loaded 2 plugins (mine) in the same page. I got a “$(…).
   autocomplete” error. The thing is that I can load jquery in the first (which 
   uses autocomplete), but not in the second otherwise I have a conflict. If I don’t
   introduce in the second, it all works – my doubt is: will it work if it’s alone?
   Apparently yes, but… So I’m confused: what is the proper way of doing this?
 * Kind regards
 * Kepler
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjquery-issue-20%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335502)
 * How come you are loading your own version of jQuery? WordPress installations 
   often have already loaded jQuery core into the page and this is the version that
   comes bundled in WordPress. By using your own version, you introduce a risk of
   making the installation incompatible with other plugins and damage the extensiblity
   of the future codebase.
    -  This reply was modified 7 years, 11 months ago by [Andrew Nevins](https://wordpress.org/support/users/anevins/).
    -  This reply was modified 7 years, 11 months ago by [Andrew Nevins](https://wordpress.org/support/users/anevins/).
 *  Thread Starter [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335522)
 * Hi
 * Yes, you are right. Still, if I remove my own jquery.min.js the script won’t 
   run in the autocomplete function.
 * Kepler
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335564)
 * Why won’t it run the autocomplete function?
 *  Thread Starter [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335586)
 * Hi
 * It simply says the function does not exists (like if 2 jquery libs were being
   loaded). Also I got a console error regarding jquery.cookie (which I’m not using–
   only if the default template is).
 * Kepler
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335822)
 * It may not exist because the UI library has not been enqueued yet: [https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress)
 * I’m going to have to leave this thread, but there are many other knowledgeable
   devs that can take this further when they’re available.
 *  Thread Starter [jkepler](https://wordpress.org/support/users/jkepler/)
 * (@jkepler)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10335947)
 * Hi
 * Thanks Andrew 🙂
 * Kepler
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10337098)
 * Even if you really must use your own version (I’m not convinced, more on this
   later), you still need to enqueue your JS of any sort by using wp_enqueue_script().
   Review the rest of the article Andrew linked to last. When you enqueue with the
   same handle, it will not matter how many times you enqueue from various plugins,
   the script reference on the page will only appear once.
 * In the case of your own jQuery (if you must), to avoid conflicts, you need to
   first deregister the default “jquery” handle, then register your version using
   the same “jquery” handle. Then enqueue it, or reference it as a dependency while
   enqueuing some other script.
 * Now, about autocomplete not working. Let’s approach this the proper way and see
   if it can be resolved without requiring custom jQuery. Remove the script references
   to your version and enqueue “jquery” registered as the default WP version. Refer
   to the examples in Andrew’s link for specifics. Also note that the default jQuery
   runs in noConflict mode, so you cannot use the `$` shortcut, you need to use `
   jQuery` unless you use a [noConflict wrapper](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress/#comment-content-1831).
 * Also enqueue any other external JS files you may be using. If they rely upon 
   jQuery, be sure to specify `['jquery']` as the dependency argument of wp_enqueue_script().
   If this still fails to work for you, please post here the exact error messages
   from your browser console.
 * Also, if you can provide a link to a live page that uses your scripts, that can
   be very helpful in helping you resolve this.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Jquery issue’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 7 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/jquery-issue-20/#post-10337098)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
