jQuery noconflict example

jquery noconflict example

WordPress is wonderful publishing platform with many JavaSript Framework including jQuery. Until today jQuery is one of the favorite JavaScript library, it’s more easy, a lot of plugin available in the internet.

Some problem on jQuery and other JavaScript library is, conflict between this library. To eliminate this problem, jQuery has method by added some code jQuery.noConflict(); and don’t worry, WordPress has been added some tricks and added this featured too, using jQuery with other libraries in WordPress is easy, all need to do just write your JavaScript Code like on this example

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);

Hope this tricks for using jQuery on WordPress working great on your blogs and you didn’t found any problem on it.

You may also like...