Monday, February 17, 2014

Wordpress: jQuery problems

Using jQuery can be problematic in Wordpress as it is loaded in "no conflict" mode to prevent compatibility problems with other javascript libraries. In "no-confict" mode, the $ shortcut is not available and the longer jQuery is used.

All you have to do is wrap your code like this:

 jQuery(function ($) {  
           Put your code here...  
           You can safely use $ in this code block to reference jQuery  

Complementary Cat Picture:

No comments:

Post a Comment