Daily Archives: Saturday 02/01/2010

Ficus Standing Tall My Life 02 JAN 2010

Amazingly enough, contrary to Terrance’s utterances as one of the Best Men at our wedding, we have managed to keep something alive for longer than a week. As you can see from my painstakingly gained proof, Ficus still stands proud and tall at our back sliding door. As does Ficus’ faithful fluffers, the Vygies.

Just saying.

Looking good for a tree cared for by Craig and Chantelle, eh?

Using jQuery with other Javascript Libraries: jQuery.noConflict CodeUnit 02 JAN 2010

You’ll often find yourself using frameworks that may be running a number of different javascript libraries such as MooTools, jQuery and ProtoType (depending on the various involved developers’ plugin preferences of course), which leaves you with the interesting quandry of what to do with the shared $ variable that most libraries tend to have a different use for.

Thankfully though, jQuery comes bundled with a nifty little function to deal with this hassle for us.

jQuery.noConflict() is a function that when run, gives control of the $ variable back to whichever library first implemented it. Of course, once run you do need to change your approach to calling jQuery magic by using the jQuery variable, for example where you might have in the past used $(‘div p’) as a selector, you would now have to replace it with jQuery(‘div p’).

The jQuery.noConflict function must be called after including the main jQuery javascript file but before including any other conflicting library, as well as before any other conflicting library does actually get used. Interestingly enough though, you can actually make the function call right at the end of the main jQuery.js file itself, to globally disable the $() jQuery alias across the site.

Useful eh?

Related Link: http://docs.jquery.com/Using_jQuery_with_Other_Libraries