Why Won’t my jQuery Play Nice with WordPress?

WordPress automatically loads jQuery in “no conflict” mode so that it will be compatible with other libraries. This means the $ variable isn’t used for jQuery within WordPress.

Rewrite your code to use the full jQuery keyword when you begin your closure like this:

jQuery(document).ready(function($) {

    // ... other code in here

});

This is functionally the same as $(document).ready(function() { but uses the full name of the jQuery object to avoid noConflict issues. By passing jQuery in to the closure as the $ variable you can then use $ like normal inside the closure.