The jQuery library included with WordPress loads in “no conflict” mode. This is to prevent compatibility problems with other javascript libraries that WordPress can load.
In order to use the default jQuery shortcut of $, you can use the following wrapper around your code:
jQuery(document).ready(function($) {
// $() will work as an alias for jQuery() inside of this function
});
That wrapper will cause your code to be executed when the page finishes loading, and the $ will work for calling jQuery. If, for some reason, you want your code to execute immediately (instead of waiting for the DOM ready event), then you can use this wrapper method instead:
(function($) {
// $() will work as an alias for jQuery() inside of this function
})(jQuery);
Related Posts:
- Pass PHP variable to javascript
- force enqueue script to be first in order of prominence
- WordPress 3.5 Media Manager – add a button
- How can I make default jquery version of WordPress “async”?
- Help making my pagination plugin better
- Handling jQuery Component Collision
- How to Add jQuery Infinite Scroll to My Custom Archive Page
- jQuery plugin only in one page/post
- Is dynamic forms/entries possible in Widget?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Editor not displaying dynamically after clicking on the button
- jQuery AJAX call not executing in Plugin
- WordPress Enqueue Script Chaos (jQuery & Foundation.js)
- How to fetch serialized data from wordpress options
- Check javascript file Proper way in functions.php
- How to load plugin before the wordpress jquery?
- WordPress Plugin development Call to undefined function jQuery()
- Add jQuery to WordPress page
- Why is my ajax call refreshing the page?
- How do I use WordPress PHP functions in my Javascript code?
- Disable wordpress from including jQuery in the head section
- What’s the point of using WordPress’s built in admin-ajax.php?
- Admin-ajax.php is dying “0” without processing function
- How to load default scripts included with WordPress correctly?
- Get image URL from media library in input
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Ajax with jQuery UI dialog not working
- Plugin jQuery version VS Theme jQuery version: search for best practice
- Adding a jquery script to plugin contact form 7
- jQuery function didn’t work in my plugin
- WordPress 3.5 Media Manager – add a button
- jQuery Plugin to use WordPress functions in AJAX request
- Handling jQuery Component Collision
- How do I make sure a plugin loads a script after jQuery
- how to include a simple jquery file into a wordpress plugin
- Add get_option to jquery
- Check if email address exists front end with AJAX in a plugin
- Pass a php string to a javascript variable
- Confused about shortcode and settings values
- Running jquery script after shortcode [closed]
- Calling JavaScript file with Custom Plugin
- Problem in loading javascript in footer
- JQuery not working in my plugin [closed]
- Using jquery migrate for plugins incompatible with jquery 1.10.2
- Specific plugin script not working on subdomain
- Add HTML between feed items
- Javascript in plugin not working
- WordPress Feedback popup with date saved into table
- Not getting result using ajax on wordpress
- Theme Load Error
- How to Add Jquery FullCalendar in wp plugin in admin
- Creating a comments voting system
- WordPress ajax not working in registration
- Plugin program: JQuery not working in this plugin
- AJAX doesn’t pass variables to the php function in the plugin
- How to add jquery to my custom post type wp plugin
- What is the process for reimplementing a back up WordPress?
- Like/Dislike Bar not working when updating
- jquery-issue: cannot load the basic jquery
- Possible jquery / library conflict in plugin usage
- Ajax, jQuery and WordPress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- Add jQuery in dashboard when is already added in main plugin page
- jQuery loaded in wrong order for non-admin page views only
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Why won’t the Comprehensive Google Map Plugin load?
- PHP and Jquery pass value from form. Update function on DataBase
- WordPress plugin ajax post parameter
- get_option include in my adsense
- how to call jQuery in admin as well as in homepage
- “The Events Calendar” Issues in WP 3.2
- Plugin use of ajax/jquery depending dropdown
- How do I output user_registered time in my correct timezone?
- Ajax in Plugins: returns the whole page
- Element works, but not on wordpress site [duplicate]
- Shortcode return is printing a 1 afterward
- Load css classes after using ajax calls
- WordPress site keeps getting flagged as malware [closed]
- FacetWP: Plugin breaks button/modal functionality inside searchable content area
- How to resolve these findings from security audit
- TypeErrors with Yoast, jQuery in conflict?
- Javascript as Jquery Function Call?
- Integrating WordPress Content into a jQuery Slider
- JQuery UI plugin not working in IE7?
- Animate like Stack exchange frequently asked questions [closed]
- Jquery based image accordian plugin
- wordpress jquery is not defined because the head tag is empty
- Count div with class (.length) only shows 0 [closed]
- Jquery post responses 500 error after some time and lastly an 503 error
- Change page content based on dropdown selection
- Ajax button “Load more” is not loading correct language version posts for logged out users
- WordPress GiveWP Plugin showing blank page in none default theme [closed]
- How to add an active state class to my info box
- Woocommerce attatch files and custom input meta to cart items and then to order
- Ajax response from Media Selection does not update ALL information more than once
- Custom plugin translation not working
- How to ajaxify all pages of my Wp Site
- implement pop up in wordpress cdn’s in wordpress admin side