What does window.jQuery and window.$ mean?

I will pull from an article I linked to in a comment above:

As discussed in the JavaScript Basics section, valid names in JavaScript can be pretty much anything, as long as they don’t begin with a number and don’t include a hyphen. So, the $ in the code above is just a shorter, more convenient name for the jQuery function; indeed, in the jQuery source code, you’ll find this near the end:

// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;

When you call the $() function and pass a selector to it, you create a new jQuery object. Of course, in JavaScript, functions are objects too, so that means that $ (and jQuery, of course) has properties and methods, too. For example, you can refer to the $.support property for information on what the current browser environment supports, and you use the $.ajax method to make an AJAX request.

Basically, jQuery (when you include it) creates functions at window.$ and window.jquery. Then it sets $ equal to both of those to $ for convenience.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)