Using “jQuery” instead of “$” in WordPress

In jQuery, the dollar sign character ($) is a shortcut used to represent “jQuery”. You can start your expressions like this:

$('.content').css('color','red');

But, other JS libraries and frameworks also use this character, so with WordPress you must use “JQuery” instead of “$”.

jQuery('.content').css('color','red');

There is a workaround where you can wrap the code in an anonymous function and still use “$”.

(function($) {
	
  $('.content').css('color','red');
	
})( jQuery );

read more…

digwp.com/2011/09/using-instead-of-jquery-in-wordpress

It's only fair to share...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on Google+
This entry was posted in jQuery, WordPress and tagged , . Bookmark the permalink.