Javascript framework conflicts (0)Add to My Brief

Emmet Murray | 29/11/2011

Personally I primarily use JQuery as my javascript framework of choice, for everything. But on occasion there can be a need to use another framework on the same page as jQuery. Other frameworks include Prototype, Moo-tools and  YUI. These frameworks may have a unique or exclusive function or plugin that a client has requested, and which can’t be replicated in jQuery.

Using two different frameworks on the same page can cause conflicts and errors mainly because of jQuery’s use of the ($)dollar symbol as a shortcut for “jQuery”. However, the jQuery library has a solution for this in the form of the jquery.noconflict() function. Adding this function at any point after the jQuery and other library has loaded,  will revert  ($) back to its original library.

Another technique is to add the document.ready() function inside a ghost function first: 

And the last method is to assign assign jQuery to any other variable name to use it as your shorthand , as oppose to the ($) symbol. E.g  var j = jQuery;

tags: Web Development

Interested in learning more?

Wiliam is a leading supplier of web solutions and can provide expert advice to assist your business or organisation online.

Make enquiry   Request quotation

Comments

Share this page

Print this page Email this page to a friend Copy the URL of this page

No Brief added yet.

My Brief results-driven approach emphasises a commitment to our clients needs through strategic analysis and best-practice.

Add to My Brief

Click on this icon to save item into My Brief. Retrieve, email and print

Drag & Drop

Drag & drop any iten with this icon into My Brief. Retrieve, email and print

Search Blogs