Question

The codebase I've inherited is full of $() methods and $.() methods.

eg.

$("#buttona").show();

$("#buttonb").show();

or

bComment = $.trim($("#aComment" + i).val().replace(/"/g, "'").replace(/\,/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">"));

Which leads me to believe that this is jQuery.

For example that trim method, appears to be a jquery method (takes a string as a parameter) rather than a core javascript method.

However, I can't see any reference to the jQuery source in the code base. I did a search for 'jquery' over the entire codebase, and couldn't find any src = jquery...js references- as said is necessary here..

How is it that this code could be otherwise running jQuery?

Was it helpful?

Solution

I'm answering this one, since Arun P Johny isn't answering.

Yes you are right. That's jquery.

You can check for its version by doing $.fn.jquery or jQuery.fn.jquery. This will return version.

The reason you didn't see a src = jquery..js might be because the script references may have been dynamically assigned. You can see which scripts were actually referenced by looking at the how the script was resolved in your browser (by pressing F12).

But Arun.P.Johny answered it first ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top