Search code examples
jqueryprototypejs

How to verify that jQuery isn't being superseded by Prototype.js


Quick question that I couldn't solve with Google.

I have a pre-existing web application that is running jQuery and Prototype.js. I'm getting strange results when I try to use jQuery in this app so I decided to test a few things in Chrome's console.

When I type in the dollar sign "$" while on my site, it returns the following:

function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (Object.isString(element))
    element = document.getElementById(element);
  return Element.extend(element);
} 

but most importantly, it states that this information is coming from prototype on the right-hand side along with a line number.

Does this mean that prototype.js could be using the $ declaration instead of jQuery? Thanks.


Solution

  • Most likely yes, you also type the following in the console to verify whether $ is jQuery:

    $ == jQuery