
Using dollar sign $ and jQuery in WordPress
As you may noticed, your jQuery scripts under WordPress environment may not work correctly while using $ (dollar sign) as jQuery handler. Why? Because there are conflict between your jQuery and WP’s jquery. So, what shall I do? There are a few good solutions to avoid this.
First:
1 2 |
var $ = jQuery.noConflict(); $('#do-what').html('you want...'); |
Second (my fav if there is no problem with document.ready check):
1 2 3 |
( function( $ ) { $('#do-what').html('you want...'); } ) ( jQuery ); |
Third (my fav when you need to hook document.ready event)
1 2 3 |
jQuery( document ).ready( function( $ ) { $('#do-what').html('you want...'); } ); |
Easy and simple.

