jquery conflicts – how to avoid

For those scripting developers who enjoy the flexibility of using jQuery to deliver front end solutions to their website users.

One common obstacle from developers who like to incorporate scripts from third parties are instances of on jQuery conflicts that cause the scripts to misfire or not run at all.

What tends to happen is that the original developer created their script in isolation.  Working in isolation and focusing on their task, they overlooked the fact that one day their script would be used in a setting that supported multiple jQuery scripts.

Because they were working in isolation, they referenced the jQuery session with a default of ‘$’
ie…    $(document).ready(function(){

Working in their own lab, this is fine, but if the next or previous script writer also used the same ‘$’ reference, both scripts will conflicit and stop working.

The work around
Give each individual session a unique name…. NOT ‘$’ 

var jq = $.noConflict();
        jq(“p”).text(“jQuery is still working!”);

Adwords (1)

Branding (13)

CMS (3)

CSS (6)

Graphic Design (6)

Javascript (1)

PHP (3)

SEO (5)

tech support (5)

Web Design (10)

Web Development (10)

Wordpress (17)

Wordpress plugins (3)