Skip to content Skip to sidebar Skip to footer

What Is The Difference Between These Two Word In JQuery

I am trying to get the version of jQuery a page is using in an alert. It works perfect: I use alert(jQuery.prototype.jquery) Now my question is what is the difference between jQuer

Solution 1:

The first is specified by "$", the second is meant to return the jquery version number.

In Chrome console ->

jQuery >>> function (a,b){return new e.fn.init(a,b,h)}

$ >>> function (a,b){return new e.fn.init(a,b,h)}

jQuery.prototype.jquery >>> "1.7.1"

Perhaps it would help to note that JavaScript is case sensitive, so jQuery and jquery are two different variables.


Solution 2:

The $ is the same as jQuery with a capital 'Q'. The lowercase jquery only represents the version number.

It is more commonly written as jQuery.fn.jquery or as a property of a constructed jQuery object like jQuery('div').jquery.


Solution 3:

The global $ and jQuery variables just point to the same function object, they are "aliases". jquery is just the name of the property of the prototype object. The two names have nothing to do with each other - they are names of different properties on different objects.


Post a Comment for "What Is The Difference Between These Two Word In JQuery"