Prototype and jQuery on the same page

Discussion in 'jQuery' started by sunster13, Jun 30, 2009.

  1. #1
    Hey,

    I need someone who can help me get these 2 libraries to run on the same page. I've googled jQuery.noConflict();, but I'm still a bit confused. If you could spare 5 min to help me out, it'd be much appreciated. I've lost countless hours trying to fix it myself, and find alternatives.

    Just shoot me a PM with your MSN or AIM address.

    Thanks
     
    sunster13, Jun 30, 2009 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    jquery's noConflict is fine as an idea but keep in mind that Prototype is called that for a reason - it actually changes, extends and overwrites native javascript methods, functions, elements, arrays and objects.

    basically - there are never any guarantees that a framework that does prototyping changes will be compatible with any other. mootools does the same thing as well...

    the idea of noConflict is that it releases the $ namespace and uses jQuery instead, if i remember correctly.

    so to use it you need to change all code that refers to things like

    $(this).click(function() { ... -> jQuery(this).click(function etc

    read it again - i am not a jquery dev but this is from memory.
     
    dimitar christoff, Jul 1, 2009 IP